Skip to content

Generate and push sandboxes (main) #40

Generate and push sandboxes (main)

Generate and push sandboxes (main) #40

name: Generate and push sandboxes (main)
on:
schedule:
- cron: '2 2 */1 * *'
workflow_dispatch:
# To test fixes on push rather than wait for the scheduling, do the following:
# 1. Uncomment the lines below and add your branch.
# push:
# branches:
# - <your-branch-name>
# 2. change the "ref" value to <your-branch-name> in the actions/checkout step below.
# 3. 👉 DON'T FORGET TO UNDO THE VALUES BACK TO `main` BEFORE YOU MERGE YOUR CHANGES!
jobs:
generate:
runs-on: ubuntu-latest
env:
YARN_ENABLE_IMMUTABLE_INSTALLS: false
CLEANUP_SANDBOX_NODE_MODULES: true
steps:
- uses: actions/checkout@v3
with:
ref: main
- uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
- name: Setup git user
run: |
git config --global user.name "Storybook Bot"
git config --global user.email "[email protected]"
- name: Install dependencies
run: |
cd ./scripts
node --experimental-modules ./check-dependencies.js
cd ..
- name: Compile Storybook libraries
run: yarn task --task compile --start-from=auto --no-link
- name: Publishing to local registry
run: yarn local-registry --publish
working-directory: ./code
- name: Running local registry
run: yarn local-registry --open &
working-directory: ./code
- name: Wait for registry
run: yarn wait-on http://localhost:6001
working-directory: ./code
- name: Generate
run: yarn generate-sandboxes --local-registry
working-directory: ./code
- name: Publish
run: yarn publish-sandboxes --remote=https://storybook-bot:${{ secrets.PAT_STORYBOOK_BOT}}@github.com/storybookjs/sandboxes.git --push --branch=main
working-directory: ./code
- name: The job has failed
if: ${{ failure() || cancelled() }}
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_MONITORING_URL }}
uses: Ilshidur/action-discord@master
with:
args: 'The generation of sandboxes in the **main** branch has failed. [View Run](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})'