Skip to content

chore: release v0.1.2 #3

chore: release v0.1.2

chore: release v0.1.2 #3

Workflow file for this run

name: Auto Tag
on:
workflow_dispatch:
push:
branches: [main]
paths: [Cargo.toml]
permissions:
contents: write
actions: write
jobs:
tag:
name: Create version tag
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
- uses: dtolnay/rust-toolchain@631a55b12751854ce901bb631d5902ceb48146f7 # stable
with:
toolchain: stable
- name: Get version from Cargo.toml
id: version
run: |
version="$(cargo metadata --no-deps --format-version=1 | jq -r '.packages[0].version')"
echo "version=$version" >> "$GITHUB_OUTPUT"
- name: Check if tag exists
id: check
env:
TAG: v${{ steps.version.outputs.version }}
run: |
if git tag -l "$TAG" | grep -q .; then
echo "exists=true" >> "$GITHUB_OUTPUT"
else
echo "exists=false" >> "$GITHUB_OUTPUT"
fi
- name: Create and push tag
if: steps.check.outputs.exists == 'false'
env:
TAG: v${{ steps.version.outputs.version }}
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git tag -a "$TAG" -m "Release $TAG"
git push origin "$TAG"
- name: Trigger Release workflow
if: steps.check.outputs.exists == 'false'
env:
GH_TOKEN: ${{ github.token }}
TAG: v${{ steps.version.outputs.version }}
run: gh workflow run Release --ref main -f tag="$TAG"