Try to create a github release pushing a git tag #1
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: Create a github release for a git tag | |
on: | |
push: | |
tags: | |
- 'v*.*.*' | |
- 'v*.*' | |
jobs: | |
# Check that the tag matches the lastest version in the code | |
check-version: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Check version | |
run: | | |
# Get the latest version from the code | |
latest_version=$(sed -r 's/__version__ = "(.*)"/\1/' ravenpackapi/version.py) | |
# Get the tag from the git tag | |
tag=$(echo $GITHUB_REF | sed -r 's/refs\/tags\/v(.*)/\1/') | |
# Check that the tag matches the latest version | |
if [ "v$latest_version" != "$tag" ]; then | |
echo "The tag $tag does not match the latest version $latest_version" | |
exit 1 | |
fi | |
# Create a release | |
github-release: | |
name: >- | |
📦✍ Sign the package with Sigstore | |
and upload them to GitHub Release | |
runs-on: ubuntu-latest | |
needs: check-version | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Dump the changelog | |
run: .github/changelogtext.sh > '${{ github.ref_name }}.md' | |
- name: Create GitHub Release | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
run: | | |
latest_version=$(sed -r 's/__version__ = "(.*)"/\1/' ravenpackapi/version.py) | |
gh release create '${{ github.ref_name }}' -F '${{ github.ref_name }}.md' --title "Version $latest_version" --repo '${{ github.repository }}' |