17d97e13c0
If the release action is run without an explicit version in the same calendar month more than once, all of them will try to release the same version where the patch version is set to 0. This is never the intended action: if we are making a new release in the same month where an old one exists, it is 100% a patch release. This PR automatically implements patch version increment based on existing versions.
50 lines
1.9 KiB
YAML
50 lines
1.9 KiB
YAML
name: release
|
|
on:
|
|
repository_dispatch:
|
|
types: [release]
|
|
schedule:
|
|
# 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 * *'
|
|
jobs:
|
|
release:
|
|
runs-on: ubuntu-latest
|
|
name: "Release a new version"
|
|
steps:
|
|
- id: calver
|
|
if: ${{ !github.event.client_payload.version }}
|
|
run: |
|
|
DATE_PART=$(date +'%y.%-m')
|
|
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++ ))
|
|
done
|
|
echo "::set-output name=version::"$DATE_PART.$PATCH_VERSION""
|
|
- uses: actions/checkout@v2
|
|
- uses: getsentry/craft@master
|
|
if: ${{ !github.event.client_payload.skip_prepare }}
|
|
with:
|
|
action: prepare
|
|
version: ${{ github.event.client_payload.version || steps.calver.outputs.version }}
|
|
env:
|
|
DRY_RUN: ${{ github.event.client_payload.dry_run }}
|
|
GIT_COMMITTER_NAME: getsentry-bot
|
|
GIT_AUTHOR_NAME: getsentry-bot
|
|
EMAIL: bot@getsentry.com
|
|
# Wait until the builds start. Craft should do this automatically
|
|
# but it is broken now.
|
|
# TODO: Remove this once getsentry/craft#111 is fixed
|
|
- run: sleep 10
|
|
- uses: getsentry/craft@master
|
|
with:
|
|
action: publish
|
|
version: ${{ github.event.client_payload.version || steps.calver.outputs.version }}
|
|
keep_branch: '--keep-branch'
|
|
no_merge: '--no-merge'
|
|
env:
|
|
DRY_RUN: ${{ github.event.client_payload.dry_run }}
|
|
GIT_COMMITTER_NAME: getsentry-bot
|
|
GIT_AUTHOR_NAME: getsentry-bot
|
|
EMAIL: bot@getsentry.com
|