Skip to content

Commit

Permalink
Release pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
IgKh committed Jan 22, 2024
1 parent 718bc8e commit 07fca12
Show file tree
Hide file tree
Showing 4 changed files with 100 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
cache: true

- name: Configure
run: mkdir build && cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug
run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug

- name: Build
run: cmake --build build -j $(nproc)
91 changes: 91 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: Create release builds
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'

jobs:
create-source-tarball:
runs-on: ubuntu-latest

steps:
- name: Checkout source code
uses: actions/checkout@v3

- name: Determine version
run: echo "VERSION=$(grep KATVAN_VERSION CMakeLists.txt | cut -d"\"" -f2)" >> $GITHUB_ENV

- name: Collect tarball
run: |
mkdir dist
tar cfz dist/katvan-${VERSION}.tar.gz \
--transform "flags=r;s|^|katvan-${VERSION}/|" \
--exclude-vcs \
--exclude .github \
--exclude dist *
- name: Upload tarball
uses: actions/upload-artifact@v4
with:
name: tarball
path: dist/katvan-${{ env.VERSION }}.tar.gz
if-no-files-found: error

build-linux-appimage:
runs-on: ubuntu-20.04

steps:
- name: Checkout source code
uses: actions/checkout@v3

- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
version: 6.5.*
modules: 'qtpdf'
cache: true

- name: Install missing libraries
run: sudo apt install libxcb-cursor0

- name: Install AppImage tools
uses: miurahr/install-linuxdeploy-action@v1
with:
plugins: qt appimage

- name: Configure
run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr

- name: Build
run: cmake --build build -j $(nproc)

- name: Initialize AppDir
run: cmake --build build --target install DESTDIR=AppDir

- name: Generate AppImage
run: linuxdeploy-x86_64.AppImage --appdir build/AppDir --plugin qt --output appimage

- name: Upload AppImage
uses: actions/upload-artifact@v4
with:
name: AppImage
path: Katvan-x86_64.AppImage
if-no-files-found: error

create-release:
runs-on: ubuntu-latest
needs: [create-source-tarball, build-linux-appimage]
permissions:
contents: write

steps:
- name: Checkout source code
uses: actions/checkout@v3

- name: Download artifacts
uses: actions/download-artifact@v4

- name: Create draft release
run: gh release create --draft --verify-tag ${{ github.ref_name }} tarball/* AppImage/*
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
build/
build*/
9 changes: 7 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,12 @@ int main(int argc, char** argv)
QApplication app(argc, argv);
QCoreApplication::setOrganizationName("Katvan");
QCoreApplication::setApplicationName("Katvan");
QCoreApplication::setApplicationVersion(katvan::KATVAN_VERSION + "-" + katvan::KATVAN_GIT_SHA);

QString version = katvan::KATVAN_VERSION;
if (!katvan::KATVAN_GIT_SHA.isEmpty()) {
version += "-" + katvan::KATVAN_GIT_SHA;
}
QCoreApplication::setApplicationVersion(version);

QCommandLineOption forceHebrewUI("heb", "Force Hebrew UI");

Expand All @@ -51,7 +56,7 @@ int main(int argc, char** argv)

QTranslator qtTranslator;
if (qtTranslator.load(locale, "qtbase", "_", QLibraryInfo::path(QLibraryInfo::TranslationsPath))) {
app.installTranslator(&qtTranslator);
QCoreApplication::installTranslator(&qtTranslator);
}

katvan::MainWindow wnd;
Expand Down

0 comments on commit 07fca12

Please sign in to comment.