Skip to content

Merge pull request #15 from GaZaTu/feature/system-emoji-font-override #61

Merge pull request #15 from GaZaTu/feature/system-emoji-font-override

Merge pull request #15 from GaZaTu/feature/system-emoji-font-override #61

Workflow file for this run

name: Build
on:
push:
branches: [master]
tags:
- 'v*'
pull_request:
branches: [master]
workflow_dispatch:
env:
DEBIAN_FRONTEND: noninteractive
jobs:
build-artifact:
runs-on: ubuntu-latest
container:
image: ${{matrix.image}}
options: --privileged
strategy:
matrix:
image: ['ubuntu:23.04', 'ubuntu:22.04', 'ubuntu:20.04', 'debian:12', 'debian:11', 'debian:10', 'opensuse/leap:15.4', 'fedora:40', 'fedora:39', 'fedora:38']
fail-fast: false
steps:
- name: Install dependencies (ubuntu & debian)
if: startsWith(matrix.image, 'ubuntu') || startsWith(matrix.image, 'debian')
run: apt update && apt install -y wget file dpkg-dev fuse git g++ cmake qtbase5-dev libicu-dev libglib2.0-dev ibus libibus-1.0-dev fcitx5 libfcitx5core-dev libfcitx5config-dev libfcitx5utils-dev
- name: Install dependencies (opensuse)
if: startsWith(matrix.image, 'opensuse')
run: zypper refresh && zypper install -y tar gzip wget rpm-build git gcc-c++ cmake libqt5-qtbase-devel libicu-devel glibc-devel ibus ibus-devel
- name: Install dependencies (fedora)
if: startsWith(matrix.image, 'fedora')
run: dnf clean expire-cache && dnf install -y tar gzip wget rpm-build git gcc-c++ cmake qt5-qtbase-devel libicu-devel glib-devel fcitx5 fcitx5-devel ibus ibus-devel
- uses: actions/checkout@v3
- run: git config --global --add safe.directory $(realpath .)
continue-on-error: true
- run: git fetch --prune --unshallow --tags --force
continue-on-error: true
- name: Set CPACK_GENERATOR to DEB (ubuntu / debian)
if: startsWith(matrix.image, 'ubuntu') || startsWith(matrix.image, 'debian')
run: |
echo "CPACK_GENERATOR=DEB" >> $GITHUB_ENV
- name: Set CPACK_GENERATOR to RPM (opensuse / fedora)
if: startsWith(matrix.image, 'opensuse') || startsWith(matrix.image, 'fedora')
run: |
echo "CPACK_GENERATOR=RPM" >> $GITHUB_ENV
- name: Create artifact version
run: |
VERSION_LATEST_TAG=$(git describe --match "v[0-9]*" --abbrev=0 HEAD | sed "s/v//")
VERSION_TIMESTAMP=$(date +'%Y%m%d%H%M')
VERSION_GIT_HASH=$(git rev-parse --short HEAD)
VERSION=$VERSION_LATEST_TAG+git$VERSION_TIMESTAMP.$VERSION_GIT_HASH
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "VERSION=$VERSION"
continue-on-error: true
- name: Create artifact name
run: |
DISTRO_ID=$(grep "^ID=" "/etc/os-release" | sed "s/ID=//" | sed "s/\"//g")
DISTRO_VERSION_ID=$(grep "^VERSION_ID=" "/etc/os-release" | sed "s/VERSION_ID=//" | sed "s/\"//g")
ARTIFACT_NAME=im-emoji-picker-x86_64
ARTIFACT_NAME_WITH_DISTRO=$ARTIFACT_NAME-$DISTRO_ID-$DISTRO_VERSION_ID
echo "ARTIFACT_NAME=$ARTIFACT_NAME" >> $GITHUB_ENV
echo "ARTIFACT_NAME_WITH_DISTRO=$ARTIFACT_NAME_WITH_DISTRO" >> $GITHUB_ENV
echo "ARTIFACT_NAME_WITH_DISTRO=$ARTIFACT_NAME_WITH_DISTRO"
- name: Package (Fcitx5)
if: startsWith(matrix.image, 'ubuntu') || startsWith(matrix.image, 'debian') || startsWith(matrix.image, 'fedora')
run: |
rm -rf build
mkdir -p build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCPACK_GENERATOR=${{env.CPACK_GENERATOR}} -DPACKAGE_VERSION=${{env.VERSION}} -DONLY_FCITX5=1 ..
make -j$(nproc)
make package
- name: Move Fcitx5 .deb artifact
if: startsWith(matrix.image, 'ubuntu') || startsWith(matrix.image, 'debian')
run: |
mv build/*.deb ${{env.ARTIFACT_NAME_WITH_DISTRO}}-fcitx5.deb 2>/dev/null; true
continue-on-error: true
- name: Move Fcitx5 .rpm artifact
if: startsWith(matrix.image, 'opensuse') || startsWith(matrix.image, 'fedora')
run: |
mv build/*.rpm ${{env.ARTIFACT_NAME_WITH_DISTRO}}-fcitx5.rpm 2>/dev/null; true
continue-on-error: true
- name: Package (IBus)
if: startsWith(matrix.image, 'ubuntu') || startsWith(matrix.image, 'debian') || startsWith(matrix.image, 'fedora') || startsWith(matrix.image, 'opensuse')
run: |
rm -rf build
mkdir -p build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCPACK_GENERATOR=${{env.CPACK_GENERATOR}} -DPACKAGE_VERSION=${{env.VERSION}} -DONLY_IBUS=1 ..
make -j$(nproc)
make package
- name: Move IBus .deb artifact
if: startsWith(matrix.image, 'ubuntu') || startsWith(matrix.image, 'debian')
run: |
mv build/*.deb ${{env.ARTIFACT_NAME_WITH_DISTRO}}-ibus.deb 2>/dev/null; true
continue-on-error: true
- name: Move IBus .rpm artifact
if: startsWith(matrix.image, 'opensuse') || startsWith(matrix.image, 'fedora')
run: |
mv build/*.rpm ${{env.ARTIFACT_NAME_WITH_DISTRO}}-ibus.rpm 2>/dev/null; true
continue-on-error: true
- name: Upload Fcitx5 artifact .deb (ubuntu / debian)
if: startsWith(matrix.image, 'ubuntu') || startsWith(matrix.image, 'debian')
uses: actions/upload-artifact@v3
with:
name: ${{env.ARTIFACT_NAME_WITH_DISTRO}}-fcitx5.deb
path: ${{env.ARTIFACT_NAME_WITH_DISTRO}}-fcitx5.deb
if-no-files-found: ignore
- name: Upload Fcitx5 artifact .rpm (opensuse / fedora)
if: startsWith(matrix.image, 'opensuse') || startsWith(matrix.image, 'fedora')
uses: actions/upload-artifact@v3
with:
name: ${{env.ARTIFACT_NAME_WITH_DISTRO}}-fcitx5.rpm
path: ${{env.ARTIFACT_NAME_WITH_DISTRO}}-fcitx5.rpm
if-no-files-found: ignore
- name: Upload IBus artifact .deb (ubuntu / debian)
if: startsWith(matrix.image, 'ubuntu') || startsWith(matrix.image, 'debian')
uses: actions/upload-artifact@v3
with:
name: ${{env.ARTIFACT_NAME_WITH_DISTRO}}-ibus.deb
path: ${{env.ARTIFACT_NAME_WITH_DISTRO}}-ibus.deb
if-no-files-found: ignore
- name: Upload IBus artifact .rpm (opensuse / fedora)
if: startsWith(matrix.image, 'opensuse') || startsWith(matrix.image, 'fedora')
uses: actions/upload-artifact@v3
with:
name: ${{env.ARTIFACT_NAME_WITH_DISTRO}}-ibus.rpm
path: ${{env.ARTIFACT_NAME_WITH_DISTRO}}-ibus.rpm
if-no-files-found: ignore
create-nightly-release:
needs: build-artifact
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
steps:
- name: Download artifacts
id: download_artifacts
uses: actions/download-artifact@v3
with:
path: artifacts
- name: Create nightly
id: create_release
uses: ncipollo/[email protected]
with:
removeArtifacts: true
allowUpdates: true
artifactErrorsFailBuild: true
artifacts: "${{steps.download_artifacts.outputs.download-path}}/*/*"
body: ${{github.event.head_commit.message}}
prerelease: true
makeLatest: false
name: Nightly Release
tag: nightly-build
create-release:
needs: build-artifact
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
steps:
- name: Set env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Download artifacts
id: download_artifacts
uses: actions/download-artifact@v3
with:
path: artifacts
- name: Create nightly
id: create_release
uses: ncipollo/[email protected]
with:
removeArtifacts: false
allowUpdates: false
artifactErrorsFailBuild: true
artifacts: "${{steps.download_artifacts.outputs.download-path}}/*/*"
generateReleaseNotes: true
prerelease: false
makeLatest: true
name: ${{env.RELEASE_VERSION}}
tag: ${{github.ref}}