-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: simplify production release reverts (#678)
Update the Production Terraform workflows so that a release can more easily be reverted. Now all that will be required to rollback a failed release is to revert the Release Please PR.
- Loading branch information
Showing
5 changed files
with
145 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: Get infrastructure version to deploy | ||
|
||
inputs: | ||
is-tagged: | ||
description: "Is this for the release of a tagged version? This action will wait for the tag to exist if so." | ||
required: true | ||
outputs: | ||
version: | ||
description: "Infrastructure version to deploy" | ||
value: ${{ steps.output-version.outputs.version }} | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Get version, release PR branch | ||
if: inputs.is-tagged == 'false' && startsWith(github.head_ref, 'release-please--') | ||
env: | ||
GITHUB_HEAD_REF: ${{ github.head_ref }} | ||
run: echo "version=$GITHUB_HEAD_REF" >> $GITHUB_ENV | ||
shell: bash | ||
|
||
- name: Get version, perform release of tag | ||
if: inputs.is-tagged == 'true' | ||
run: echo "version=v$(cat version.txt)" >> $GITHUB_ENV | ||
shell: bash | ||
|
||
- name: Wait for tag to exist | ||
if: inputs.is-tagged == 'true' | ||
run: ./.github/workflows/scripts/wait-for-tag.sh ${{ env.version }} | ||
shell: bash | ||
|
||
- name: Fail if no version set | ||
if: env.version == '' | ||
run: exit 1 | ||
shell: bash | ||
|
||
- name: Output version | ||
id: output-version | ||
run: echo "version=${{ env.version }}" >> $GITHUB_OUTPUT | ||
shell: bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/bin/bash | ||
|
||
# | ||
# Given a git tag name as an argument, this script will wait until the tag is available in the remote repository. | ||
# The wait is based on the values of CHECK_INTERVAL and MAX_CHECKS. | ||
# | ||
# Usage: | ||
# ./wait-for-tag.sh v1.2.3 | ||
# | ||
|
||
set -euo pipefail | ||
IFS=$'\n\t' | ||
|
||
TAG_NAME="$1" | ||
CHECK_INTERVAL=5 | ||
MAX_CHECKS=20 | ||
|
||
for ((i=1; i<=MAX_CHECKS; i++)); do | ||
git fetch --tags > /dev/null 2>&1 | ||
if git rev-parse "$TAG_NAME" >/dev/null 2>&1; then | ||
echo "🎉 Tag $TAG_NAME exists!" | ||
exit 0 | ||
fi | ||
echo "Tag $TAG_NAME not found. Checking again in $CHECK_INTERVAL seconds... (Attempt $i/$MAX_CHECKS)" | ||
sleep $CHECK_INTERVAL | ||
done | ||
|
||
echo "💀 Tag $TAG_NAME does not exist after $MAX_CHECKS attempts..." | ||
exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters