From 2098949a582a0bc4750f3c9c6cf8f8a5b88f448b Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Mon, 27 Nov 2023 15:24:44 +0100 Subject: [PATCH] Building package only if it's tagged. --- .github/workflows/build_pkg.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.github/workflows/build_pkg.yml b/.github/workflows/build_pkg.yml index dfe3c45..d6c2a7c 100644 --- a/.github/workflows/build_pkg.yml +++ b/.github/workflows/build_pkg.yml @@ -32,6 +32,10 @@ on: message: type: string default: "" + +env: + GH_TOKEN: ${{ github.token }} + jobs: source: name: source package @@ -51,6 +55,17 @@ jobs: repository: ${{ inputs.repository }} ref: ${{ inputs.ref }} path: input + - name: check if HEAD contains tag + id: tagged + run: | + TAG=$(git tag --points-at HEAD) + echo $TAG + if [[ -n $TAG ]]; then + echo "Commit is tagged. Building package with Tag: $TAG" + else + echo "Commit is not tagged." + gh run cancel ${{ github.run_id }} + fi - name: pull build container run: podman pull "${{ inputs.build_container }}:amd64" - name: fetch dependencies