123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- name: release
- on:
- workflow_dispatch:
- inputs:
- version:
- description: Version to release (optional)
- required: false
- skip_prepare:
- description: Skip preparation step (assume a release branch is ready)
- required: false
- default: false
- dry_run:
- description: Do not actually cut the release
- required: false
- default: false
- schedule:
- # We want the release to be at 9-10am Pacific Time
- # We also want it to be 1 hour before the on-prem release
- - cron: '0 17 15 * *'
- jobs:
- release:
- runs-on: ubuntu-latest
- name: 'Release a new version'
- steps:
- - id: killswitch
- 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: set-version
- run: |
- if [[ -n '${{ github.event.inputs.version }}' ]]; then
- echo '::set-env name=RELEASE_VERSION::${{ github.event.inputs.version }}';
- 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 "::set-env name=RELEASE_VERSION::${DATE_PART}.${PATCH_VERSION}"
- fi
- - uses: actions/checkout@v2
- with:
- token: ${{ secrets.GH_SENTRY_BOT_PAT }}
- - id: set-git-user
- run: |
- git config user.name getsentry-bot
- git config user.email bot@getsentry.com
- - uses: getsentry/craft@master
- if: ${{ !github.event.inputs.skip_prepare }}
- with:
- action: prepare
- 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 }}
- - uses: getsentry/craft@master
- with:
- action: publish
- version: ${{ env.RELEASE_VERSION }}
- env:
- DRY_RUN: ${{ github.event.inputs.dry_run }}
- GITHUB_API_TOKEN: ${{ secrets.GH_SENTRY_BOT_PAT }}
- ZEUS_API_TOKEN: ${{ secrets.ZEUS_API_TOKEN }}
- TWINE_USERNAME: '__token__'
- TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
- DOCKER_USERNAME: 'sentrybuilder'
- DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
- - id: next-dev-version
- if: ${{ !github.event.inputs.dry_run }}
- run: |
- ./scripts/bump-version.sh '' $(date -d "$(echo $RELEASE_VERSION | sed -e 's/^\([0-9]\{2\}\)\.\([0-9]\{1,2\}\)\.[0-9]\+$/20\1-\2-1/') 1 month" +%y.%-m.0.dev0)
- git diff --quiet || git commit -anm 'meta: Bump new development version' && git push
|