From 89ad60ae1a35ac89771e75742f1fec54d6f09c8a Mon Sep 17 00:00:00 2001 From: Ryan Laurie <30528226+iethree@users.noreply.github.com> Date: Mon, 4 Nov 2024 12:42:11 -0700 Subject: [PATCH] Add release channel option to publish job (#48633) * only tag nightly on the current version * add release channel setting to publish job * clean up release workflow * remove code from something else * fix step title --- .github/workflows/release-tag.yml | 15 ++++-- .github/workflows/release.yml | 86 +++++++++---------------------- 2 files changed, 35 insertions(+), 66 deletions(-) diff --git a/.github/workflows/release-tag.yml b/.github/workflows/release-tag.yml index 85b74f7f241..c01adbb16a4 100644 --- a/.github/workflows/release-tag.yml +++ b/.github/workflows/release-tag.yml @@ -39,6 +39,7 @@ on: # - nightly # - beta # - latest + # - none (skips everything) required: true tag_rollout: description: Rollout % (0-100) @@ -54,7 +55,15 @@ on: default: true jobs: + green-check-stub: + runs-on: ubuntu-22.04 + timeout-minutes: 2 + steps: + - name: Stub + run: echo "Stub to make this job successful even if all the rest of the steps are skipped" check-version: + # skips everything if the tag_name is 'none' because all later jobs depend on this job + if: ${{ inputs.tag_name != 'none' }} runs-on: ubuntu-22.04 timeout-minutes: 5 outputs: @@ -185,7 +194,7 @@ jobs: return upload_path; - - name: Upload to s3 latest path + - name: Upload to s3 ${{ inputs.tag_name }} path run: | # sh aws s3 cp \ s3://${{ vars.AWS_S3_DOWNLOADS_BUCKET }}/${{ steps.source_path.outputs.result }}/metabase.jar \ @@ -270,7 +279,8 @@ jobs: steps: - uses: actions/checkout@v4 with: - fetch-depth: 0 # fetch all history + fetch-depth: 0 # we want all branches and tags + fetch-tags: true - name: Add and push git tag run: | # sh @@ -333,7 +343,6 @@ jobs: }); fs.writeFileSync('version-info.json', JSON.stringify(newVersionInfo)); - - name: Upload new version-info.json to S3 run: | if [[ "${{ matrix.edition }}" == "ee" ]]; then diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 241d1a235f4..cdd4845a81b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,26 +11,16 @@ on: commit: description: 'A full-length commit SHA-1 hash' required: true - skip-docker: - description: 'Skip Docker image publishing' - type: boolean - default: false - skip-s3: - description: 'Skip S3 artifact publishing' - type: boolean - default: false - skip-version-info: - description: 'Skip publishing version-info.json' - type: boolean - default: false - skip-tag: - description: 'Skip tagging the release' - type: boolean - default: false - skip-release-notes: - description: 'Skip publishing release notes' - type: boolean - default: false + release-channel: + description: 'The release channel to publish to (optional)' + type: choice + options: + - none + - latest + - beta + - nightly + required: true + default: 'none' auto: description: 'auto-patch release DO NOT SET MANUALLY' type: boolean @@ -192,7 +182,6 @@ jobs: ./version.properties upload-to-s3: - if: ${{ inputs.skip-s3 != true }} runs-on: ubuntu-22.04 needs: download-uberjar timeout-minutes: 15 @@ -242,7 +231,6 @@ jobs: verify-s3-download: - if: ${{ inputs.skip-s3 != true }} runs-on: ubuntu-22.04 needs: upload-to-s3 timeout-minutes: 15 @@ -276,7 +264,6 @@ jobs: run: grep -q $(sha256sum ./metabase-downloaded.jar) SHA256.sum && echo "checksums match" || exit 1 containerize: - if: ${{ inputs.skip-docker != true }} runs-on: ubuntu-22.04 needs: [check-version, download-uberjar] timeout-minutes: 15 @@ -361,7 +348,6 @@ jobs: echo "Finished!" verify-docker-pull: - if: ${{ inputs.skip-docker != true }} runs-on: ubuntu-22.04 needs: containerize timeout-minutes: 15 @@ -410,7 +396,6 @@ jobs: timeout-minutes: 3 push-tags: - if: ${{ inputs.skip-tag != true }} permissions: write-all needs: [verify-s3-download, verify-docker-pull, check-version] runs-on: ubuntu-22.04 @@ -461,7 +446,7 @@ jobs: $GITHUB_WORKSPACE/release/reorder-tags.sh ${{ needs.check-version.outputs.ee }} ${{ inputs.commit }} trigger-docs-update: - if: ${{ !inputs.auto && inputs.skip-release-notes != true }} + if: ${{ !inputs.auto }} needs: - push-tags - check-version @@ -577,7 +562,7 @@ jobs: }); draft-release-notes: - if: ${{ !inputs.auto && inputs.skip-release-notes != true }} + if: ${{ !inputs.auto }} needs: push-tags runs-on: ubuntu-22.04 timeout-minutes: 15 @@ -629,7 +614,6 @@ jobs: }); publish-version-info: - if: ${{ !inputs.auto && inputs.skip-version-info != true }} runs-on: ubuntu-22.04 needs: [push-tags, check-version] timeout-minutes: 15 @@ -640,6 +624,11 @@ jobs: AWS_S3_STATIC_BUCKET: ${{ vars.AWS_S3_STATIC_BUCKET }} AWS_REGION: ${{ vars.AWS_REGION }} steps: + - name: Finish early + if: ${{ inputs.auto }} + run: | + echo "skipping version info update for nightly patch" + exit 0 - name: Configure AWS credentials uses: aws-actions/configure-aws-credentials@v4 with: @@ -687,22 +676,20 @@ jobs: --distribution-id ${{ vars.AWS_CLOUDFRONT_STATIC_ID }} \ --paths "/version-info.json" "/version-info-ee.json" - tag-nightly: - if: false - needs: [push-tags, verify-docker-pull, verify-s3-download, check-version] + set-release-channel: + needs: publish-version-info uses: ./.github/workflows/release-tag.yml secrets: inherit with: version: ${{ inputs.version }} - tag_name: nightly + tag_name: ${{ inputs.release-channel }} tag_rollout: 100 tag_ee: true tag_oss: true publish-complete-message: - if: ${{ !inputs.auto }} runs-on: ubuntu-22.04 - needs: [draft-release-notes, verify-docker-pull, verify-s3-download, publish-version-info] + needs: set-release-channel timeout-minutes: 5 steps: - uses: actions/checkout@v4 @@ -719,34 +706,7 @@ jobs: script: | # js const { sendPublishCompleteMessage } = require('${{ github.workspace }}/release/dist/index.cjs'); - await sendPublishCompleteMessage({ - owner: context.repo.owner, - repo: context.repo.repo, - version: '${{ inputs.version }}', - runId: '${{ github.run_id }}', - channelName: '${{ vars.SLACK_RELEASE_CHANNEL }}', - generalChannelName: 'general', - }).catch(console.error); - - auto-publish-complete-message: - if: ${{ inputs.auto }} - runs-on: ubuntu-22.04 - needs: tag-nightly - timeout-minutes: 5 - steps: - - uses: actions/checkout@v4 - with: - sparse-checkout: release - - name: Prepare build scripts - run: cd ${{ github.workspace }}/release && yarn && yarn build - - name: Send auto publish complete message - uses: actions/github-script@v7 - env: - SLACK_RELEASE_CHANNEL: ${{ vars.SLACK_RELEASE_CHANNEL }} - SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} - with: - script: | # js - const { sendPublishCompleteMessage } = require('${{ github.workspace }}/release/dist/index.cjs'); + const isAutoRelease = '${{ inputs.auto }}' === 'true'; await sendPublishCompleteMessage({ owner: context.repo.owner, @@ -754,7 +714,7 @@ jobs: version: '${{ inputs.version }}', runId: '${{ github.run_id }}', channelName: '${{ vars.SLACK_RELEASE_CHANNEL }}', - generalChannelName: '', + generalChannelName: !isAutoRelease ? '${{ vars.SLACK_GENERAL_CHANNEL }}' : '', }).catch(console.error); manage-milestones: -- GitLab