From 8f71d5ee49dd88fe5206968a4c93f0b07475fe72 Mon Sep 17 00:00:00 2001 From: Freya Gustavsson Date: Mon, 4 Nov 2024 15:35:19 +0100 Subject: [PATCH] chore: Improve autotag and build rpm again This should hopefully tag and have all the variables accessible without issue. --- .github/workflows/autotag.yml | 5 +++++ .github/workflows/build-rpm.yml | 18 ++++++++++-------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/.github/workflows/autotag.yml b/.github/workflows/autotag.yml index 42f8db6ce..363905a0f 100644 --- a/.github/workflows/autotag.yml +++ b/.github/workflows/autotag.yml @@ -26,3 +26,8 @@ jobs: git config --local user.name "GitHub Actions" git tag ${{ steps.determine_tag.outputs.tag }} git push origin ${{ steps.determine_tag.outputs.tag }} + + - name: Call build RPM workflow + uses: oamg/convert2rhel/.github/workflows/build-rpm.yml@main + with: + tag: ${{ steps.determine_tag.outputs.tag }} diff --git a/.github/workflows/build-rpm.yml b/.github/workflows/build-rpm.yml index 781d526cd..a43b9ef6d 100644 --- a/.github/workflows/build-rpm.yml +++ b/.github/workflows/build-rpm.yml @@ -2,10 +2,12 @@ name: Build release RPMs on: - workflow_run: - workflows: [Auto Tag] - types: - - completed + workflow_call: + inputs: + tag: + required: false + type: string + default: "v0.0.0" push: tags: - v* @@ -32,15 +34,15 @@ jobs: uses: actions/checkout@v4 - name: Get tag - if: ${{ github.event_name != 'release' }} + if: startsWith(github.event.ref, 'refs/tags/') id: tag uses: devops-actions/action-get-tag@v1.0.3 with: strip_v: true # Optional: Remove 'v' character from version - default: ${{ github.event.inputs.tag }} # Optional: Default version when tag not found + default: ${{ inputs.tag }} # Optional: Default version when tag not found - name: Update specfile to match tag - if: ${{ github.event_name != 'release' && steps.tag.outputs.tag != '0.0.0' }} + if: startsWith(github.event.ref, 'refs/tags/') && ${{ steps.tag.outputs.tag != '0.0.0' }} uses: jacobtomlinson/gha-find-replace@v3 with: include: "packaging/convert2rhel.spec" @@ -48,7 +50,7 @@ jobs: replace: "${1}${{steps.tag.outputs.tag}}" - name: Update convert2rhel version to match tag - if: ${{ github.event_name != 'release' && steps.tag.outputs.tag != '0.0.0' }} + if: startsWith(github.event.ref, 'refs/tags/') && ${{ steps.tag.outputs.tag != '0.0.0' }} uses: jacobtomlinson/gha-find-replace@v3 with: include: "convert2rhel/__init__.py"