From 02f624193347e4920a01fc9a2da5135efa979131 Mon Sep 17 00:00:00 2001 From: Jeppe Reinhold Date: Fri, 9 Feb 2024 23:27:25 +0100 Subject: [PATCH] use regular workflow instead of composite action --- .../action.yml | 67 ------------------- .github/workflows/generate-sandboxes-next.yml | 60 ----------------- .github/workflows/generate-sandboxes.yml | 63 ++++++++++++----- 3 files changed, 46 insertions(+), 144 deletions(-) delete mode 100644 .github/actions/generate-sandboxes-composite-action/action.yml delete mode 100644 .github/workflows/generate-sandboxes-next.yml diff --git a/.github/actions/generate-sandboxes-composite-action/action.yml b/.github/actions/generate-sandboxes-composite-action/action.yml deleted file mode 100644 index a4f0112731e7..000000000000 --- a/.github/actions/generate-sandboxes-composite-action/action.yml +++ /dev/null @@ -1,67 +0,0 @@ -name: Generate and push sandboxes action -description: This is a composite action that generates sandboxes and pushes them to the storybookjs/sandboxes repository - -inputs: - destination-branch: - description: The destination branch to generate sandboxes to in the storybookjs/sandboxes repository - required: true - token: - description: The personal access token to use when authenticating with the destination repository - required: true - discord-url: - description: The Discord URL to use when reporting failures - required: true - -runs: - using: "composite" - steps: - - uses: actions/setup-node@v3 - with: - node-version-file: ".nvmrc" - - - name: Setup git user - shell: bash - run: | - git config --global user.name "storybook-bot" - git config --global user.email "32066757+storybook-bot@users.noreply.github.com" - - - name: Install dependencies - shell: bash - working-directory: ./scripts - env: - YARN_ENABLE_IMMUTABLE_INSTALLS: "false" - run: node --experimental-modules ./check-dependencies.js - - - name: Compile Storybook libraries - shell: bash - run: yarn task --task compile --start-from=auto --no-link - - - name: Publish to local registry - shell: bash - run: yarn local-registry --publish - - - name: Run local registry - shell: bash - run: yarn local-registry --open & - - - name: Wait for registry - shell: bash - run: yarn wait-on tcp:127.0.0.1:6001 - - - name: Generate - shell: bash - env: - CLEANUP_SANDBOX_NODE_MODULES: "true" - run: yarn generate-sandboxes --local-registry - - - name: Publish - shell: bash - run: yarn publish-sandboxes --remote=https://storybook-bot:${{ inputs.token }}@github.com/storybookjs/sandboxes.git --push --branch=${{ inputs.destination-branch }} - - - name: The job has failed - if: ${{ failure() || cancelled() }} - env: - DISCORD_WEBHOOK: ${{ inputs.discord-url }} - uses: Ilshidur/action-discord@master - with: - args: "The generation of sandboxes in the **${{ inputs.destination-branch }}** branch has failed. [View Run](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})" diff --git a/.github/workflows/generate-sandboxes-next.yml b/.github/workflows/generate-sandboxes-next.yml deleted file mode 100644 index 2c0b592d024f..000000000000 --- a/.github/workflows/generate-sandboxes-next.yml +++ /dev/null @@ -1,60 +0,0 @@ -name: Generate and push sandboxes (next) - -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: - # - - # 2. change the "ref" value to in the actions/checkout step below. - # 3. 👉 DON'T FORGET TO UNDO THE VALUES BACK TO `next` 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: next - - 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 "bot@storybook.js.org" - - 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 tcp:127.0.0.1:6001 - working-directory: ./code - - name: Generate - run: yarn generate-sandboxes --local-registry --debug - working-directory: ./code - - name: Publish - run: yarn publish-sandboxes --remote=https://storybook-bot:${{ secrets.PAT_STORYBOOK_BOT}}@github.com/storybookjs/sandboxes.git --push --branch=next - 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 **next** branch has failed. [View Run](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})' diff --git a/.github/workflows/generate-sandboxes.yml b/.github/workflows/generate-sandboxes.yml index 942ad7527d42..8c1af15b40ad 100644 --- a/.github/workflows/generate-sandboxes.yml +++ b/.github/workflows/generate-sandboxes.yml @@ -13,6 +13,14 @@ on: # 3. Comment out the whole "generate-main" job starting at line 26 # 3. 👉 DON'T FORGET TO UNDO STEP 2 AND 3 BEFORE YOU MERGE YOUR CHANGES! +env: + YARN_ENABLE_IMMUTABLE_INSTALLS: "false" + CLEANUP_SANDBOX_NODE_MODULES: "true" + +defaults: + run: + working-directory: ./code + jobs: generate-next: name: Generate to next @@ -21,21 +29,42 @@ jobs: - uses: actions/checkout@v4 with: ref: jeppe/25922-ci-generation-of-sandboxes-fail-sometimes-on-prereleases - - uses: ./.github/actions/generate-sandboxes-composite-action + + - uses: actions/setup-node@v4 + with: + node-version-file: ".nvmrc" + + - name: Setup git user + run: | + git config --global user.name "storybook-bot" + git config --global user.email "32066757+storybook-bot@users.noreply.github.com" + + - name: Install dependencies + working-directory: ./scripts + run: node --experimental-modules ./check-dependencies.js + + - name: Compile Storybook libraries + run: yarn task --task compile --start-from=auto --no-link + + - name: Publish to local registry + run: yarn local-registry --publish + + - name: Run local registry + run: yarn local-registry --open & + + - name: Wait for registry + run: yarn wait-on tcp:127.0.0.1:6001 + + - name: Generate + run: yarn generate-sandboxes --local-registry + + - name: Publish + run: yarn publish-sandboxes --remote=https://storybook-bot:${{ secrets.PAT_STORYBOOK_BOT }}@github.com/storybookjs/sandboxes.git --push --branch=next + + - name: The job has failed + if: ${{ failure() || cancelled() }} + env: + DISCORD_WEBHOOK: ${{ secrets.DISCORD_MONITORING_URL }} + uses: Ilshidur/action-discord@master with: - destination-branch: next - token: ${{ secrets.PAT_STORYBOOK_BOT }} - discord-url: ${{ secrets.DISCORD_MONITORING_URL }} - - # generate-main: - # name: Generate to main - # runs-on: ubuntu-latest - # steps: - # - uses: actions/checkout@v4 - # with: - # ref: main - # - uses: ./.github/actions/generate-sandboxes-composite-action - # with: - # destination-branch: main - # token: ${{ secrets.PAT_STORYBOOK_BOT }} - # discord-url: ${{ secrets.DISCORD_MONITORING_URL }} + args: "The generation of sandboxes on the **next** branch has failed. [View Run](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})"