From 7c50c099250403fedf296119b84a0bb7cc82dc82 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Sat, 15 Jun 2024 12:53:33 +0200 Subject: [PATCH] feat: Add a new GitHub workflow for automatic tagging Signed-off-by: Steffen Vogel --- .github/workflows/release.yaml | 48 ++++++++++++++++++++++++++++++++++ .github/workflows/reuse.yaml | 2 +- 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/release.yaml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..cb911a0 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,48 @@ +# SPDX-FileCopyrightText: 2023-2024 Steffen Vogel +# 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) + + 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 diff --git a/.github/workflows/reuse.yaml b/.github/workflows/reuse.yaml index 222a75d..8b8d29f 100644 --- a/.github/workflows/reuse.yaml +++ b/.github/workflows/reuse.yaml @@ -9,7 +9,7 @@ on: workflow_call: jobs: - test: + reuse: name: REUSE runs-on: ubuntu-latest steps: