feat: Add a new GitHub workflow for automatic tagging #4
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SPDX-FileCopyrightText: 2023-2024 Steffen Vogel <[email protected]> | |
# SPDX-License-Identifier: Apache-2.0 | |
# yaml-language-server: $schema=https://raw.githubusercontent.com/SchemaStore/schemastore/master/src/schemas/json/github-workflow.json | |
--- | |
name: Release | |
on: | |
push: | |
branches: | |
- main | |
- semver-tagging | |
jobs: | |
semver-tag: | |
name: Add a Semver 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 current) | |
echo "Tags:" | |
git tag | |
echo | |
echo "Last commits:" | |
git log -n 5 | |
echo | |
echo "Current tag: ${CURRENT}" | |
echo "Next tag: ${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 |