| 1 |
name: release |
| 2 |
|
| 3 |
# Only do the release on vx.y.z tags. |
| 4 |
on: |
| 5 |
push: |
| 6 |
tags: |
| 7 |
- "v[0-9]+.[0-9]+.[0-9]+" |
| 8 |
|
| 9 |
# We need this to be able to create releases. |
| 10 |
permissions: |
| 11 |
contents: write |
| 12 |
|
| 13 |
jobs: |
| 14 |
# The create-release job runs purely to initialize the GitHub release itself, |
| 15 |
# and names the release after the `x.y.z` tag that was pushed. It's separate |
| 16 |
# from building the release so that we only create the release once. |
| 17 |
create-release: |
| 18 |
name: create-release |
| 19 |
runs-on: ubuntu-latest |
| 20 |
steps: |
| 21 |
- uses: actions/checkout@v4 |
| 22 |
- name: Get the release version from the tag |
| 23 |
if: env.VERSION == '' |
| 24 |
run: | |
| 25 |
echo "VERSION=${{ github.ref_name }}" >> $GITHUB_ENV |
| 26 |
echo "VERSION_NUMBER=$(echo ${{ github.ref_name }} | sed -e s'/^v//')" >> $GITHUB_ENV |
| 27 |
- name: Show the version |
| 28 |
run: | |
| 29 |
echo "VERSION = $VERSION" |
| 30 |
echo "VERSION_NUMBER = $VERSION_NUMBER" |
| 31 |
- name: Create GitHub release |
| 32 |
env: |
| 33 |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 34 |
run: gh release create "$VERSION" --verify-tag --title "$VERSION" |
| 35 |
outputs: |
| 36 |
version: ${{ env.VERSION }} |
| 37 |
version_number: ${{ env.VERSION_NUMBER }} |