Skip to content

v2.1.0

v2.1.0 #6

Workflow file for this run

name: Release
on:
release:
types: [published]
env:
GH_TOKEN: ${{ github.token }}
TAG: ${{ github.ref_name }}
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Validate tag
run: |
echo "Checking tag: $TAG"
# Check if the tag starts with 'v' and is followed by a version number
# Example: v1.0.0
if [[ "$TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "✅ Valid tag format: $TAG"
else
echo "::error file=general.yml,line=22,endLine=22,title=Invalid tag format::❌ Invalid tag format: $TAG"
exit 1
fi
- name: Create a temporary branch
id: create_branch
run: |
TMP_BRANCH="release-${TAG}"
echo "Creating branch $TMP_BRANCH from tag $TAG"
git fetch --tags
git checkout "tags/$TAG" -b "$TMP_BRANCH"
git push origin "$TMP_BRANCH"
echo "tmp_branch=$TMP_BRANCH" >> "$GITHUB_OUTPUT"
- name: Create PR
run: |
BASE_BRANCH="$(echo "$TAG" | sed 's/\..*//')"
HEAD_BRANCH="${{ steps.create_branch.outputs.tmp_branch }}"
LABEL="release"
TITLE="Release a new version"
BODY="Update version branch with the recent changes."
echo "Creating PR for $BASE_BRANCH branch"
gh pr create -B "$BASE_BRANCH" -H "$HEAD_BRANCH" -l "$LABEL" -t "$TITLE" -b "$BODY" || true