diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 294b723..f7a3440 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 }} diff --git a/.github/workflows/fedora.yml b/.github/workflows/fedora.yml index 6055449..3ecfcca 100644 --- a/.github/workflows/fedora.yml +++ b/.github/workflows/fedora.yml @@ -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