-
Notifications
You must be signed in to change notification settings - Fork 0
TT-17787: add workflow to promote the production tag #145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| name: Promote production tag | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
|
|
||
| concurrency: | ||
| group: promote-production | ||
| cancel-in-progress: false | ||
|
|
||
| # GITHUB_TOKEN stays read-only on purpose: the tag push authenticates with the | ||
| # app token below, which is on the ruleset bypass list. contents: write here | ||
| # would neither help nor be used. | ||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| promote: | ||
| runs-on: ubuntu-24.04 | ||
| steps: | ||
| - name: Generate GitHub App token | ||
| id: app-token | ||
| uses: actions/create-github-app-token@d72941d797fd3113feb6b93fd0dec494b13a2547 # v1 | ||
| with: | ||
| app-id: ${{ secrets.PROBE_APP_ID }} | ||
| private-key: ${{ secrets.PROBE_APP_PRIVATE_KEY }} | ||
|
|
||
| - name: Checkout | ||
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| fetch-tags: true | ||
| token: ${{ steps.app-token.outputs.token }} | ||
|
|
||
| - name: Promote production to main | ||
|
Check warning on line 34 in .github/workflows/promote-production.yml
|
||
| run: | | ||
| set -euo pipefail | ||
| OLD=$(git rev-parse production^{commit} 2>/dev/null || echo "none") | ||
| NEW=$(git rev-parse origin/main) | ||
|
|
||
|
Check warning on line 39 in .github/workflows/promote-production.yml
|
||
| if [ "$OLD" = "$NEW" ]; then | ||
| echo "production already points at main ($NEW), nothing to do" | ||
| echo "## :white_check_mark: production already up to date (\`$NEW\`)" >> "$GITHUB_STEP_SUMMARY" | ||
| exit 0 | ||
|
Check warning on line 43 in .github/workflows/promote-production.yml
|
||
| fi | ||
|
|
||
| git tag -f production "$NEW" | ||
| git push -f origin refs/tags/production | ||
|
|
||
| echo "promoted production: $OLD -> $NEW (by ${{ github.actor }})" | ||
| { | ||
| echo "## :rocket: production tag promoted" | ||
| echo "" | ||
| echo "| | commit |" | ||
| echo "|---|---|" | ||
| echo "| from | \`$OLD\` |" | ||
| echo "| to | \`$NEW\` |" | ||
| echo "" | ||
| echo "Promoted by @${{ github.actor }}. All \`@production\` consumers now use this commit." | ||
| } >> "$GITHUB_STEP_SUMMARY" | ||
Uh oh!
There was an error while loading. Please reload this page.