Skip to content

Fix missing v prefix in versions #10

Fix missing v prefix in versions

Fix missing v prefix in versions #10

Workflow file for this run

# on merge to main from a branch named release-*, create a tag based on version in Cargo.toml
name: Tag Release on merge to main
on:
pull_request:
types:
- closed
branches:
- main
jobs:
build:
if: github.event.pull_request.merged == true && startsWith(github.head_ref, 'release-')
runs-on: ubuntu-22.04
permissions:
contents: write
actions: write
env:
GH_TOKEN: ${{ github.token }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.merge_commit_sha }}
- uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Read version from Cargo.toml and push appropriate tag
id: read-version
run: |
CARGO_VERSION="$(cargo metadata --format-version=1 | jq -r '.packages | .[] | select(.name == "ndc-clickhouse-cli") | .version')"
VERSION_TAG="v$CARGO_VERSION"
if git rev-parse "$VERSION_TAG" >/dev/null 2>&1; then
echo >&2 "Error: Tag '$VERSION_TAG' already exists."
exit 1
fi
echo "Tagging $VERSION_TAG"
git tag $VERSION_TAG
git push --tags
# Explicitly run our release workflow for this new tag
gh workflow run deploy-stage.yaml --ref $VERSION_TAG