Skip to content

Commit

Permalink
Add workflow for pushing tag when VERSION file changes
Browse files Browse the repository at this point in the history
Signed-off-by: Yi Chen <github@chenyicn.net>
  • Loading branch information
ChenYi015 committed Jul 22, 2024
1 parent ad5be9b commit 2810ddf
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/push-tag.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Push Tag on VERSION change

on:
push:
branches:
- master
- release-*
paths:
- VERSION

jobs:
push_tag:
runs-on: ubuntu-latest

steps:
- name: Checkout source code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
- name: Read version from VERSION file
run: |
VERSION=$(cat VERSION)
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Check if tag exists
run: |
git fetch --tags
if git tag -l | grep -q "^${VERSION}$"; then
echo "TAG_EXISTS=true" >> $GITHUB_ENV
else
echo "TAG_EXISTS=false" >> $GITHUB_ENV
fi
- name: Create and push tag
if: env.TAG_EXISTS == 'false'
run: |
git tag -a "$VERSION" -m "Release $VERSION"
git push origin "$VERSION"
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v1beta2-1.6.2-3.5.0

0 comments on commit 2810ddf

Please sign in to comment.