Skip to content

Commit 99c9c52

Browse files
authored
ci(release): Align release workflow with getsentry/sentry (#744)
Adds names to steps, adds the sleep between prep and publish, adds the global git user config..
1 parent bee98fd commit 99c9c52

File tree

1 file changed

+31
-24
lines changed

1 file changed

+31
-24
lines changed

.github/workflows/release.yml

Lines changed: 31 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -21,58 +21,65 @@ on:
2121
# We want the release to be at 10 or 11am Pacific Time
2222
# We also make this an hour after all others such as Sentry,
2323
# Snuba, and Relay to make sure their releases finish.
24-
- cron: "0 18 15 * *"
24+
- cron: '0 18 15 * *'
2525
jobs:
2626
release:
2727
runs-on: ubuntu-latest
28-
name: "Release a new version"
28+
name: 'Release a new version'
2929
steps:
3030
- id: killswitch
31+
name: Check release blockers
3132
if: ${{ !github.event.inputs.force }}
3233
run: |
3334
if curl -s "https://api.github.com/repos/$GITHUB_REPOSITORY/issues?state=open&labels=release-blocker" | grep -Pzvo '\[[\s\n\r]*\]'; then
3435
echo "Open release-blocking issues found, cancelling release...";
3536
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;
3637
fi
37-
- id: calver
38-
if: ${{ !github.event.inputs.version }}
38+
- id: set-version
39+
name: Determine version
3940
run: |
40-
DATE_PART=$(date +'%y.%-m')
41-
declare -i PATCH_VERSION=0
42-
while curl -sf -o /dev/null "https://api.github.com/repos/$GITHUB_REPOSITORY/git/ref/tags/$DATE_PART.$PATCH_VERSION"; do
43-
PATCH_VERSION+=1
44-
done
45-
echo "::set-output name=version::$DATE_PART.$PATCH_VERSION"
41+
if [[ -n '${{ github.event.inputs.version }}' ]]; then
42+
echo 'RELEASE_VERSION=${{ github.event.inputs.version }}' >> $GITHUB_ENV;
43+
else
44+
DATE_PART=$(date +'%y.%-m')
45+
declare -i PATCH_VERSION=0
46+
while curl -sf -o /dev/null "https://api.github.com/repos/$GITHUB_REPOSITORY/git/ref/tags/$DATE_PART.$PATCH_VERSION"; do
47+
PATCH_VERSION+=1
48+
done
49+
echo "RELEASE_VERSION=${DATE_PART}.${PATCH_VERSION}" >> $GITHUB_ENV;
50+
fi
4651
- uses: actions/checkout@v2
4752
with:
4853
token: ${{ secrets.GH_SENTRY_BOT_PAT }}
54+
- id: set-git-user
55+
name: Set git user to getsentry-bot
56+
run: |
57+
git config --global user.name getsentry-bot
58+
git config --global user.email [email protected]
4959
- uses: getsentry/craft@master
60+
name: Craft Prepare
5061
if: ${{ !github.event.inputs.skip_prepare }}
5162
with:
5263
action: prepare
53-
version: ${{ github.event.inputs.version || steps.calver.outputs.version }}
64+
version: ${{ env.RELEASE_VERSION }}
5465
env:
5566
DRY_RUN: ${{ github.event.inputs.dry_run }}
56-
GIT_COMMITTER_NAME: getsentry-bot
57-
GIT_AUTHOR_NAME: getsentry-bot
58-
67+
# Wait until the builds start. Craft should do this automatically
68+
# but it is broken now.
69+
- run: sleep 10
5970
- uses: getsentry/craft@master
71+
name: Craft Publish
6072
with:
6173
action: publish
62-
version: ${{ github.event.inputs.version || steps.calver.outputs.version }}
63-
keep_branch: "--keep-branch"
64-
no_merge: "--no-merge"
74+
version: ${{ env.RELEASE_VERSION }}
75+
no_merge: '--no-merge'
6576
env:
6677
DRY_RUN: ${{ github.event.inputs.dry_run }}
67-
GIT_COMMITTER_NAME: getsentry-bot
68-
GIT_AUTHOR_NAME: getsentry-bot
69-
78+
# We need this additonal step because we don't merge release branches into master to
79+
# always keep it on nightlies
7080
- id: bump-license-date
81+
name: Bump license chage date
7182
if: ${{ !github.event.inputs.dry_run && !github.event.inputs.version }}
72-
env:
73-
GIT_COMMITTER_NAME: getsentry-bot
74-
GIT_AUTHOR_NAME: getsentry-bot
75-
7683
run: |
7784
sed -i -e "s/\(Change Date:\s*\)[-0-9]\+\$/\\1$(date +'%Y-%m-%d' -d '3 years')/" LICENSE
7885
git diff --quiet || git commit -anm 'license: Update BSL change date' && git push

0 commit comments

Comments
 (0)