|
21 | 21 | # We want the release to be at 10 or 11am Pacific Time |
22 | 22 | # We also make this an hour after all others such as Sentry, |
23 | 23 | # Snuba, and Relay to make sure their releases finish. |
24 | | - - cron: "0 18 15 * *" |
| 24 | + - cron: '0 18 15 * *' |
25 | 25 | jobs: |
26 | 26 | release: |
27 | 27 | runs-on: ubuntu-latest |
28 | | - name: "Release a new version" |
| 28 | + name: 'Release a new version' |
29 | 29 | steps: |
30 | 30 | - id: killswitch |
| 31 | + name: Check release blockers |
31 | 32 | if: ${{ !github.event.inputs.force }} |
32 | 33 | run: | |
33 | 34 | if curl -s "https://api.github.com/repos/$GITHUB_REPOSITORY/issues?state=open&labels=release-blocker" | grep -Pzvo '\[[\s\n\r]*\]'; then |
34 | 35 | echo "Open release-blocking issues found, cancelling release..."; |
35 | 36 | 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; |
36 | 37 | fi |
37 | | - - id: calver |
38 | | - if: ${{ !github.event.inputs.version }} |
| 38 | + - id: set-version |
| 39 | + name: Determine version |
39 | 40 | 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 |
46 | 51 | - uses: actions/checkout@v2 |
47 | 52 | with: |
48 | 53 | 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] |
49 | 59 | - uses: getsentry/craft@master |
| 60 | + name: Craft Prepare |
50 | 61 | if: ${{ !github.event.inputs.skip_prepare }} |
51 | 62 | with: |
52 | 63 | action: prepare |
53 | | - version: ${{ github.event.inputs.version || steps.calver.outputs.version }} |
| 64 | + version: ${{ env.RELEASE_VERSION }} |
54 | 65 | env: |
55 | 66 | 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 |
59 | 70 | - uses: getsentry/craft@master |
| 71 | + name: Craft Publish |
60 | 72 | with: |
61 | 73 | 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' |
65 | 76 | env: |
66 | 77 | 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 |
70 | 80 | - id: bump-license-date |
| 81 | + name: Bump license chage date |
71 | 82 | 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 | | - |
76 | 83 | run: | |
77 | 84 | sed -i -e "s/\(Change Date:\s*\)[-0-9]\+\$/\\1$(date +'%Y-%m-%d' -d '3 years')/" LICENSE |
78 | 85 | git diff --quiet || git commit -anm 'license: Update BSL change date' && git push |
0 commit comments