diff --git a/.github/workflows/automerge.yml b/.github/workflows/automerge.yml index a6fad41e54..7ad8e950a1 100644 --- a/.github/workflows/automerge.yml +++ b/.github/workflows/automerge.yml @@ -1,8 +1,12 @@ name: automerge +# This workflow is triggered when any changes are pushed to the release branch and +# when a release candidate or full release has been published in the `release-base` workflow on: + repository_dispatch: + types: [merge-to-main] push: - branches: [release/*] + branches: [release/v2*] concurrency: group: automerge-${{ github.ref }} @@ -14,6 +18,9 @@ jobs: runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v4 + with: + fetch-depth: '0' + ref: ${{ github.event.client_payload.branch }} - name: Merge to main uses: devmasx/merge-branch@1.4.0 with: diff --git a/.github/workflows/deploy-latest.yml b/.github/workflows/deploy-latest.yml index 0caa21f0fa..e403d817d3 100644 --- a/.github/workflows/deploy-latest.yml +++ b/.github/workflows/deploy-latest.yml @@ -5,7 +5,8 @@ name: Deploy production storybook # has been successfully completed on: workflow_dispatch: - workflow_call: + repository_dispatch: + types: [deploy-latest-storybook] jobs: deploy-latest-storybook: diff --git a/.github/workflows/deploy-staging.yml b/.github/workflows/deploy-staging.yml index a110a86dcd..fa01e029f5 100644 --- a/.github/workflows/deploy-staging.yml +++ b/.github/workflows/deploy-staging.yml @@ -1,12 +1,12 @@ # Deploy staging storybook environment from release branch to Github Pages name: Deploy staging storybook -# Gets triggered every time a change is pushed to the `release/v2*` branch or can be manually triggered +# Gets triggered every time a release candidate has been published from the `release-base` workflow +# or can be manually triggered on: workflow_dispatch: - workflow_call: - push: - branches: [release/v2*] + repository_dispatch: + types: [deploy-staging-storybook] jobs: deploy-staging-storybook: @@ -16,6 +16,7 @@ jobs: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1 with: fetch-depth: '0' + ref: ${{ github.event.client_payload.branch }} - name: Setup Node.js uses: actions/setup-node@v4 diff --git a/.github/workflows/release-base.yml b/.github/workflows/release-base.yml index 318999f5be..8a2a1f1179 100644 --- a/.github/workflows/release-base.yml +++ b/.github/workflows/release-base.yml @@ -114,14 +114,27 @@ jobs: echo "DRY RUN: ${{ env.DRY_RUN }}" yarn lerna publish --create-release github --preid rc --pre-dist-tag next $(echo "${{ env.DRY_RUN }}") - deploy-staging: - needs: release - # Trigger staging storybook enviroment deployment workflow - if: ${{ github.event.inputs.dry-run == 'false' }} - uses: ./.github/workflows/deploy-staging.yml - - deploy-latest: - needs: release - # If full release has been published, trigger the production storybook environment deployment workflow. - if: ${{ (github.event.inputs.dry-run == 'false') && ((github.event.inputs.type == 'full minor release') || (github.event.inputs.type == 'full patch release')) }} - uses: ./.github/workflows/deploy-latest.yml + # After successfully publishing a release candidate, trigger the staging storybook environment deployment workflow. + # Pass in the release branch name to the storybook deployment job so it build off the release branch + - name: Dispatch staging storybook deployment workflow + uses: peter-evans/repository-dispatch@v3 + with: + event-type: deploy-staging-storybook + client-payload: '{"branch": "${{ github.ref_name }}"}' + + # After successfully publishing a full release, trigger the production storybook environment deployment workflow. + # Pass in the release branch name to the storybook deployment job so it build off the release branch + - name: Dispatch production storybook deployment workflow + if: ${{ (github.event.inputs.type == 'full minor release') || (github.event.inputs.type == 'full patch release') }} + uses: peter-evans/repository-dispatch@v3 + with: + event-type: deploy-latest-storybook + client-payload: '{"branch": "${{ github.ref_name }}"}' + + # Trigger the `automerge` workflow to the changelog and version bumps generated by Lerna get pushed to `main` branch + - name: Dispatch merge to `main` workflow + uses: peter-evans/repository-dispatch@v3 + with: + event-type: merge-to-main + client-payload: '{"branch": "${{ github.ref_name }}"}' +