Update version number in Cargo.toml #2
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 release from version | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- 'Cargo.toml' | |
permissions: | |
contents: write | |
jobs: | |
check-version-and-release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
token: ${{ secrets.PAT }} | |
- name: Check if version exists as tag | |
id: check-version | |
run: | | |
VERSION=v$(grep -oP '^version = "\K[^"]+' Cargo.toml) | |
if git tag --list | grep -q "^$VERSION$"; then | |
echo "Tag $VERSION already exists" | |
else | |
gh release create $VERSION --generate-notes | |
echo "Created release $VERSION" | |
fi | |
env: | |
GITHUB_TOKEN: ${{ secrets.PAT }} |