Skip to content

Refactor debsign command in release workflow #51

Refactor debsign command in release workflow

Refactor debsign command in release workflow #51

name: Build and Test
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
defaults:
run:
shell: bash
working-directory: ./app
permissions:
contents: write
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
build_type: [Release]
c_compiler: [gcc, clang, cl]
include:
- os: ubuntu-latest
c_compiler: gcc
cpp_compiler: g++
- os: ubuntu-latest
c_compiler: clang
cpp_compiler: clang++
exclude:
- os: ubuntu-latest
c_compiler: cl
steps:
- uses: actions/checkout@v4
- name: Install Dependencies (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y \
build-essential \
cmake \
ninja-build \
pkg-config \
gcc g++ \
clang \
libgtk-4-dev \
libwebkitgtk-6.0-dev \
libjson-glib-dev
- name: Set reusable strings
id: strings
run: |
echo "build-output-dir=${{ github.workspace }}/app/build" >> "$GITHUB_OUTPUT"
- name: Configure CMake
run: >
cmake -B ${{ steps.strings.outputs.build-output-dir }}
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-S ${{ github.workspace }}/app
- name: Build
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }}
- name: Run unit tests (hb_tests)
working-directory: ${{ steps.strings.outputs.build-output-dir }}
run: ctest -C ${{ matrix.build_type }} -R hb_tests --output-on-failure
tag:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.PAT }}
- name: Get latest tag
id: latest
run: |
git fetch --tags
tag=$(git tag --sort=-v:refname | head -n 1)
if [ -z "$tag" ]; then tag="v0.0.0"; fi
echo "latest=$tag" >> $GITHUB_OUTPUT
- name: Calculate next tag
id: next
run: |
tag="${{ steps.latest.outputs.latest }}"
IFS='.' read -r major minor patch <<< "${tag#v}"
patch=$((patch + 1))
new_tag="v$major.$minor.$patch"
echo "new_tag=$new_tag" >> $GITHUB_OUTPUT
- name: Create and push tag
env:
TOKEN: ${{ secrets.PAT }}
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag ${{ steps.next.outputs.new_tag }}
git push https://$TOKEN:x-oauth-basic@github.com/${{ github.repository }}.git ${{ steps.next.outputs.new_tag }}