Skip to content

Commit

Permalink
feat: Add a new GitHub workflow for automatic tagging
Browse files Browse the repository at this point in the history
Signed-off-by: Steffen Vogel <[email protected]>
  • Loading branch information
stv0g committed Jun 15, 2024
1 parent fedbdb5 commit 12917a4
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 1 deletion.
59 changes: 59 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# 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
2 changes: 1 addition & 1 deletion .github/workflows/reuse.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
workflow_call:

jobs:
test:
reuse:
name: REUSE
runs-on: ubuntu-latest
steps:
Expand Down

0 comments on commit 12917a4

Please sign in to comment.