mirror of
https://github.com/ekaaty/ca-certificates-brazil.git
synced 2025-12-06 01:22:38 -03:00
[CI/CD] Added GH Workflows
--------- 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:
committed by
Christian Tosta
parent
3df218f8e7
commit
0683dbbed8
58
.github/workflows/ci.yml
vendored
Normal file
58
.github/workflows/ci.yml
vendored
Normal 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 }}
|
||||
70
.github/workflows/fedora.yml
vendored
Normal file
70
.github/workflows/fedora.yml
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
containers:
|
||||
default: "['fedora:latest']"
|
||||
required: false
|
||||
type: string
|
||||
tag:
|
||||
required: true
|
||||
type: string
|
||||
to_release:
|
||||
default: "0"
|
||||
required: false
|
||||
type: string
|
||||
version:
|
||||
required: true
|
||||
type: string
|
||||
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
max-parallel: 2
|
||||
matrix:
|
||||
image: ${{ fromJson(inputs.containers) }}
|
||||
runs-on: ubuntu-latest
|
||||
container: ${{ matrix.image }}
|
||||
|
||||
steps:
|
||||
- name: Prepare - local checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Prepare - install build dependencies
|
||||
run: |
|
||||
dnf -y install \
|
||||
cmake \
|
||||
gcc \
|
||||
gcc-c++ \
|
||||
git \
|
||||
openssl \
|
||||
rpm-build \
|
||||
rpmdevtools \
|
||||
tar
|
||||
|
||||
- name: Prepare - setup RPM build tree
|
||||
run: |
|
||||
rpmdev-setuptree
|
||||
|
||||
- name: Prepare - configure the source
|
||||
run: |
|
||||
cmake -B $(pwd)/build -S $(pwd)
|
||||
|
||||
- name: Build - create source tarball and SRPM package
|
||||
run: |
|
||||
cmake --build $(pwd)/build --target srpm
|
||||
|
||||
- name: Build - create RPM package
|
||||
run: |
|
||||
cmake --build $(pwd)/build --target rpms
|
||||
|
||||
- name: Publish - create GitHub release
|
||||
uses: softprops/action-gh-release@v2
|
||||
if: inputs.to_release == 1
|
||||
with:
|
||||
tag_name: ${{ inputs.tag }}
|
||||
files: |
|
||||
dist/*.rpm
|
||||
Reference in New Issue
Block a user