From aa4bafee01c96601fbd5f0123ee7099061b169d9 Mon Sep 17 00:00:00 2001 From: Burak Yigit Kaya Date: Wed, 18 Nov 2020 00:09:18 +0300 Subject: [PATCH 1/4] ci(release): Align release workflow with getsentry/sentry Adds names to steps, adds the sleep between prep and publish, adds the global git user config.. --- .github/workflows/release.yml | 53 +++++++++++++++++++++-------------- 1 file changed, 32 insertions(+), 21 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 34725dead83..81a5ead54fb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -21,58 +21,69 @@ on: # We want the release to be at 10 or 11am Pacific Time # We also make this an hour after all others such as Sentry, # Snuba, and Relay to make sure their releases finish. - - cron: "0 18 15 * *" + - cron: '0 18 15 * *' jobs: release: runs-on: ubuntu-latest - name: "Release a new version" + name: 'Release a new version' steps: - id: killswitch + name: Check release blockers if: ${{ !github.event.inputs.force }} run: | if curl -s "https://api.github.com/repos/$GITHUB_REPOSITORY/issues?state=open&labels=release-blocker" | grep -Pzvo '\[[\s\n\r]*\]'; then echo "Open release-blocking issues found, cancelling release..."; curl -sf -X POST -H 'Accept: application/vnd.github.v3+json' -H 'Authorization: token ${{ secrets.GITHUB_TOKEN }}' https://api.github.com/repos/$GITHUB_REPOSITORY/actions/runs/${{ github.run_id }}/cancel; fi - - id: calver - if: ${{ !github.event.inputs.version }} + - id: set-version + name: Determine version run: | - DATE_PART=$(date +'%y.%-m') - declare -i PATCH_VERSION=0 - while curl -sf -o /dev/null "https://api.github.com/repos/$GITHUB_REPOSITORY/git/ref/tags/$DATE_PART.$PATCH_VERSION"; do - PATCH_VERSION+=1 - done - echo "::set-output name=version::$DATE_PART.$PATCH_VERSION" + if [[ -n '${{ github.event.inputs.version }}' ]]; then + echo 'RELEASE_VERSION=${{ github.event.inputs.version }}' >> $GITHUB_ENV; + else + DATE_PART=$(date +'%y.%-m') + declare -i PATCH_VERSION=0 + while curl -sf -o /dev/null "https://api.github.com/repos/$GITHUB_REPOSITORY/git/ref/tags/$DATE_PART.$PATCH_VERSION"; do + PATCH_VERSION+=1 + done + echo "RELEASE_VERSION=${DATE_PART}.${PATCH_VERSION}" >> $GITHUB_ENV; + fi - uses: actions/checkout@v2 with: token: ${{ secrets.GH_SENTRY_BOT_PAT }} + - id: set-git-user + name: Set git user to getsentry-bot + run: | + git config --global user.name getsentry-bot + git config --global user.email bot@getsentry.com - uses: getsentry/craft@master + name: Craft Prepare if: ${{ !github.event.inputs.skip_prepare }} with: action: prepare - version: ${{ github.event.inputs.version || steps.calver.outputs.version }} + version: ${{ env.RELEASE_VERSION }} env: DRY_RUN: ${{ github.event.inputs.dry_run }} GIT_COMMITTER_NAME: getsentry-bot GIT_AUTHOR_NAME: getsentry-bot EMAIL: bot@getsentry.com + ZEUS_API_TOKEN: ${{ secrets.ZEUS_API_TOKEN }} + # Wait until the builds start. Craft should do this automatically + # but it is broken now. + - run: sleep 10 - uses: getsentry/craft@master + name: Craft Publish with: action: publish - version: ${{ github.event.inputs.version || steps.calver.outputs.version }} - keep_branch: "--keep-branch" - no_merge: "--no-merge" + version: ${{ env.RELEASE_VERSION }} + no_merge: '--no-merge' env: DRY_RUN: ${{ github.event.inputs.dry_run }} - GIT_COMMITTER_NAME: getsentry-bot - GIT_AUTHOR_NAME: getsentry-bot - EMAIL: bot@getsentry.com + # We need this additonal step because we don't merge release branches into master to + # keep always keep it on nightlies - id: bump-license-date + name: Bump license chage date if: ${{ !github.event.inputs.dry_run && !github.event.inputs.version }} - env: - GIT_COMMITTER_NAME: getsentry-bot - GIT_AUTHOR_NAME: getsentry-bot - EMAIL: bot@getsentry.com run: | sed -i -e "s/\(Change Date:\s*\)[-0-9]\+\$/\\1$(date +'%Y-%m-%d' -d '3 years')/" LICENSE git diff --quiet || git commit -anm 'license: Update BSL change date' && git push From b284f9f1d32ce4663b72c2b4bcd4e773caddbfce Mon Sep 17 00:00:00 2001 From: Burak Yigit Kaya Date: Wed, 18 Nov 2020 00:17:33 +0300 Subject: [PATCH 2/4] remove git author env vars --- .github/workflows/release.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 81a5ead54fb..7af9348da1f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -64,9 +64,6 @@ jobs: version: ${{ env.RELEASE_VERSION }} env: DRY_RUN: ${{ github.event.inputs.dry_run }} - GIT_COMMITTER_NAME: getsentry-bot - GIT_AUTHOR_NAME: getsentry-bot - EMAIL: bot@getsentry.com ZEUS_API_TOKEN: ${{ secrets.ZEUS_API_TOKEN }} # Wait until the builds start. Craft should do this automatically # but it is broken now. From 534066869f75fe2b4170d9979cbdd090996595e1 Mon Sep 17 00:00:00 2001 From: Burak Yigit Kaya Date: Wed, 18 Nov 2020 00:20:32 +0300 Subject: [PATCH 3/4] fix grammer in comment --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7af9348da1f..92a5aa58ebe 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -77,7 +77,7 @@ jobs: env: DRY_RUN: ${{ github.event.inputs.dry_run }} # We need this additonal step because we don't merge release branches into master to - # keep always keep it on nightlies + # always keep it on nightlies - id: bump-license-date name: Bump license chage date if: ${{ !github.event.inputs.dry_run && !github.event.inputs.version }} From 8a1cf82a79e29169226cdee1c08d70c63c4bd110 Mon Sep 17 00:00:00 2001 From: Burak Yigit Kaya Date: Wed, 18 Nov 2020 00:21:36 +0300 Subject: [PATCH 4/4] remove unnecessary zeus_api_token --- .github/workflows/release.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 92a5aa58ebe..7460c4133e3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -64,7 +64,6 @@ jobs: version: ${{ env.RELEASE_VERSION }} env: DRY_RUN: ${{ github.event.inputs.dry_run }} - ZEUS_API_TOKEN: ${{ secrets.ZEUS_API_TOKEN }} # Wait until the builds start. Craft should do this automatically # but it is broken now. - run: sleep 10