Skip to content

Commit

Permalink
feat(ci): Add action to add SemVer tags
Browse files Browse the repository at this point in the history
Signed-off-by: Steffen Vogel <post@steffenvogel.de>
  • Loading branch information
stv0g committed Nov 7, 2024
1 parent 9a3f211 commit a1e92b4
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/release-tag.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# SPDX-FileCopyrightText: 2023-2024 Steffen Vogel <post@steffenvogel.de>
# SPDX-License-Identifier: Apache-2.0

# yaml-language-server: $schema=https://raw.githubusercontent.com/SchemaStore/schemastore/master/src/schemas/json/github-workflow.json
---
name: Tag Semver

on:
push:
branches:
- main

jobs:
semver-tag:
name: Add a Semantic Versioned Tag
runs-on: ubuntu-latest

permissions:
contents: write

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.PAT }}

- uses: actions/setup-go@v5
with:
go-version: '1.22.2'

- name: Setup svu
run: |
go install github.com/caarlos0/svu@latest
- name: Create new tag
run: |
CURRENT=$(svu current)
NEXT=$(svu next)
if [ ${CURRENT} != ${NEXT} ]; then
git tag ${NEXT}
git push origin tag ${NEXT}
echo "Tagged new release with ${NEXT}"
else
echo "No new commits to tag"
fi

0 comments on commit a1e92b4

Please sign in to comment.