[CI/CD] Added GH Workflows
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>
Co-authored-by: Leonardo Amaral <contato@leonardoamaral.com.br>

[CI/CD] Added GH Workflows
This commit is contained in:
Christian Tosta
2025-04-22 16:42:48 -03:00
committed by Christian Tosta
parent 3df218f8e7
commit 0683dbbed8
5 changed files with 269 additions and 0 deletions

58
.github/workflows/ci.yml vendored Normal file
View File

@@ -0,0 +1,58 @@
name: Build and Release CI
on:
push:
schedule:
- cron: '30 3 * * *'
workflow_dispatch:
jobs:
release-ci:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.get_metadata.outputs.version }}
tag: ${{ steps.get_metadata.outputs.tag }}
to_release: ${{ steps.newtag.outputs.to_release }}
steps:
- name: Local checkout
uses: actions/checkout@v4
- name: Install CI dependencies
run: |
sudo apt-get update
sudo apt-get -y -qq install cmake g++ gcc
- name: Get latest package metadata
id: get_metadata
run: |
cmake --fresh -B build -S .
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
shell: bash
run: |
git show-ref \
--tags --verify --quiet -- \
"refs/tags/${{ steps.get_metadata.outputs.tag }}" \
&& echo tagged=1 >> $GITHUB_OUTPUT \
|| echo tagged=0 >> $GITHUB_OUTPUT
- name: Create new tag and set to_release
id: newtag
if: steps.tagged.outputs.tagged == 0
run: |
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:
needs: release-ci
uses: ./.github/workflows/fedora.yml
with:
containers: "['fedora:latest', 'fedora:41']"
version: ${{ needs.release-ci.outputs.version }}
to_release: ${{ needs.release-ci.outputs.to_release }}
tag: ${{ needs.release-ci.outputs.tag }}