determinate-nix-action/.github/workflows/release.yml
Cole Helbling 5122d3f714
ci: only publish on "published" event
From our testing, this is the only event that triggers once-and-only-once per release.
2025-06-05 14:16:20 -07:00

34 lines
935 B
YAML

on:
release:
types:
- published
jobs:
PushLooseTag:
environment: production
permissions:
id-token: write
contents: write
runs-on: ubuntu-latest
steps:
- name: Optionally tag a vMAJOR tag
id: check_tag
env:
VERSION: ${{ github.ref_name }}
run: |
if ! echo "$VERSION" | grep -q "^v[[:digit:]]\+\.[[:digit:]]\+\.[[:digit:]]\+$"; then
echo "version needs to be a version, in x.y.z format."
echo "Therefore, not pushing a v<short>"
exit 0
fi
shorttag=$(echo "$VERSION" | cut -d'.' -f1)
echo "shorttag=$shorttag" >> "$GITHUB_OUTPUT"
- uses: actions/checkout@v4
- name: Create the short tag
env:
SHORTTAG: ${{ steps.check_tag.outputs.shorttag }}
run: |
git tag --force "$SHORTTAG"
git push --force origin "$SHORTTAG"