[CI/CD] Attempt to fix releasing issue from GH Actions
Some checks failed
Build and Release CI / release-ci (push) Has been cancelled
Build and Release CI / build-fedora (push) Has been cancelled

Signed-off-by: Leonardo Amaral <contato@leonardoamaral.com.br>
This commit is contained in:
Leonardo Amaral
2025-04-19 22:05:24 -03:00
parent e82c47bd49
commit 09be0895f4
2 changed files with 26 additions and 19 deletions

View File

@@ -9,7 +9,9 @@ jobs:
release-ci:
runs-on: ubuntu-latest
outputs:
VERSION: ${{ steps.get_metadata.outputs.VERSION }}
version: ${{ steps.get_metadata.outputs.version }}
tag: ${{ steps.get_metadata.outputs.tag }}
to_release: ${{ steps.newtag.outputs.to_release }}
steps:
- name: Local checkout
@@ -24,8 +26,8 @@ jobs:
id: get_metadata
run: |
cmake --fresh -B build -S .
echo "TAG=v$(cat build/version)" >> $GITHUB_OUTPUT
echo "VERSION=$(cat build/version)" >> $GITHUB_OUTPUT
echo "tag=v$(cat build/version)" >> $GITHUB_OUTPUT
echo "version=$(cat build/version)" >> $GITHUB_OUTPUT
- name: Check if package version has corresponding git tag
id: tagged
@@ -33,15 +35,17 @@ jobs:
run: |
git show-ref \
--tags --verify --quiet -- \
"refs/tags/${{ steps.get_metadata.outputs.TAG }}" \
"refs/tags/${{ steps.get_metadata.outputs.tag }}" \
&& echo tagged=1 >> $GITHUB_OUTPUT \
|| echo tagged=0 >> $GITHUB_OUTPUT
- name: Create new tag
- name: Create new tag and set to_release
id: newtag
if: steps.tagged.outputs.tagged == 0
run: |
git tag ${{ steps.get_metadata.outputs.TAG }} \
&& git push origin ${{ steps.get_metadata.outputs.TAG }} \
git tag ${{ steps.get_metadata.outputs.tag }} \
&& echo to_release=1 >> $GITHUB_OUTPUT \
&& git push origin ${{ steps.get_metadata.outputs.tag }} \
|| exit 0
build-fedora:
@@ -49,4 +53,6 @@ jobs:
uses: ./.github/workflows/fedora.yml
with:
containers: "['fedora:latest', 'fedora:41']"
version: ${{ needs.release-ci.outputs.VERSION }}
version: ${{ needs.release-ci.outputs.version }}
to_release: ${{ needs.release-ci.outputs.to_release }}
tag: ${{ needs.release-ci.outputs.tag }}

View File

@@ -9,6 +9,16 @@ on:
version:
required: false
type: string
to_release:
required: false
type: string
tag:
required: false
type: string
defaults:
run:
shell: bash
jobs:
build:
@@ -60,20 +70,11 @@ jobs:
dnf -y builddep ~/rpmbuild/SPECS/${PKG_NAME}.spec
rpmbuild -ba ~/rpmbuild/SPECS/${PKG_NAME}.spec
- name: Check if package version has corresponding git tag
id: tagged
shell: bash
run: |
git show-ref \
--tags --verify --quiet -- \
"refs/tags/${NEW_TAG}" \
&& echo tagged=1 >> $GITHUB_OUTPUT \
|| echo tagged=0 >> $GITHUB_OUTPUT
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
if: github.ref_type == 'tag' && steps.tagged.output.tagged == 1
if: inputs.to_release == 1
with:
tag_name: ${{ inputs.tag }}
files: |
~/rpmbuild/RPMS/*/*.rpm
~/rpmbuild/SRPMS/*.rpm