doc: Add improvements to container run config ⚓ #126
Workflow file for this run
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
name: goreleaser | |
on: | |
push: | |
tags: | |
# This is not a real version tag, its just used to trigger | |
# the release build. Glob pattern: | |
- "prepare-v[0-9]+.[0-9]+.[0-9]+*" | |
jobs: | |
goreleaser: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Set up Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: "1.20" | |
- name: Import GPG Key | |
id: import_gpg | |
uses: crazy-max/ghaction-import-gpg@v3 | |
with: | |
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} | |
passphrase: ${{ secrets.PASSPHRASE }} | |
- name: Store Git Tag | |
id: "getTag" | |
run: | | |
echo ::set-output name=releaseTag::$(echo "${GITHUB_REF##*prepare-}") | |
echo ::set-output name=triggerTag::$(echo "${GITHUB_REF##*/}") | |
- name: "Tag release commit" | |
env: | |
RELEASE_TAG: ${{ steps.getTag.outputs.releaseTag }} | |
TRIGGER_TAG: ${{ steps.getTag.outputs.triggerTag }} | |
run: | | |
git config user.name 'githooks-bot' | |
git config user.email '[email protected]' | |
deref() { git for-each-ref "refs/tags/$TRIGGER_TAG" --format="%($1)" ; }; | |
git tag "$RELEASE_TAG" -a -m "$(deref contents)" | |
git tag "githooks/$RELEASE_TAG" | |
- name: Safety Check | |
env: | |
RELEASE_TAG: ${{ steps.getTag.outputs.releaseTag }} | |
run: | | |
git fetch --depth 50 origin main | |
[ -n "$(git rev-list --first-parent --ancestry-path "$RELEASE_TAG^..origin/main")" ] || { | |
echo "Tag is not reachable from main (--first-parent) !" >&2 | |
exit 1 | |
} | |
- name: Run GoReleaser | |
uses: goreleaser/goreleaser-action@v2 | |
with: | |
version: latest | |
workdir: githooks | |
args: release --clean | |
env: | |
GORELEASER_CURRENT_TAG: ${{ steps.getTag.outputs.releaseTag }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} | |
- name: "Push release tags and delete trigger tag" | |
env: | |
RELEASE_TAG: ${{ steps.getTag.outputs.releaseTag }} | |
TRIGGER_TAG: ${{ steps.getTag.outputs.triggerTag }} | |
run: | | |
# go releaser already pushed release tag | |
git push origin "githooks/$RELEASE_TAG" | |
git push -f origin ":$TRIGGER_TAG" |