diff --git a/.github/workflows/tag.yml b/.github/workflows/tag.yml new file mode 100644 index 0000000..05ac4b1 --- /dev/null +++ b/.github/workflows/tag.yml @@ -0,0 +1,31 @@ +name: create-tag + +on: + push: + branches: ["main"] + paths: ["VERSION"] + +jobs: + tag: + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Read version + id: version + run: echo "tag=v$(xargs < VERSION)" >> "$GITHUB_OUTPUT" + + - name: Create and push tag + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + TAG="${{ steps.version.outputs.tag }}" + if git rev-parse "$TAG" >/dev/null 2>&1; then + echo "Tag $TAG already exists, skipping." + exit 0 + fi + git tag "$TAG" + git push origin "$TAG" diff --git a/VERSION b/VERSION index 7f20734..6d7de6e 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.0.1 \ No newline at end of file +1.0.2