From 06ca807fb0516fa39b91d4437a05c2a031fc8b1b Mon Sep 17 00:00:00 2001 From: LY <51789698+Young-Lord@users.noreply.github.com> Date: Mon, 8 Jul 2024 21:27:09 +0800 Subject: [PATCH] ci: auto tag --- .github/workflows/autotag.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .github/workflows/autotag.yml diff --git a/.github/workflows/autotag.yml b/.github/workflows/autotag.yml new file mode 100644 index 0000000..a3aeabc --- /dev/null +++ b/.github/workflows/autotag.yml @@ -0,0 +1,23 @@ +name: Auto Tag +on: [push] + +permissions: + contents: write + +jobs: + tag: + name: Auto Tag + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + # parse version from git log like `release: 0.0.35` + - name: Get version + run: | + version=$(git log --pretty=oneline -1 | grep -oP 'release: \K[0-9.]+' || echo '') + echo VERSION=$version >> $GITHUB_ENV + # create & push tag + - name: Create & push tag + if: ${{ env.VERSION != '' }} + run: | + git tag v$VERSION + git push origin v$VERSION