mirror of
https://github.com/zealdocs/zeal.git
synced 2026-08-29 16:40:51 +08:00
296 lines
9.5 KiB
YAML
296 lines
9.5 KiB
YAML
name: Release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- "v*.*.*"
|
|
|
|
permissions: {}
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}
|
|
cancel-in-progress: false
|
|
|
|
env:
|
|
QT_VERSION: "6.10.2"
|
|
QT_MODULES: >-
|
|
qtpositioning
|
|
qtwebchannel
|
|
qtwebengine
|
|
|
|
jobs:
|
|
build-windows:
|
|
name: ${{ matrix.config.name }}
|
|
runs-on: ${{ matrix.config.os }}
|
|
environment: release
|
|
permissions:
|
|
attestations: write
|
|
contents: write
|
|
id-token: write
|
|
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
config:
|
|
- name: Windows Server 2022
|
|
os: windows-2022
|
|
configurePreset: release
|
|
buildPreset: release
|
|
uploadPattern: "zeal-*-windows-x64.msi"
|
|
- name: Windows Server 2022 / Portable
|
|
os: windows-2022
|
|
configurePreset: release-portable
|
|
buildPreset: release-portable
|
|
uploadPattern: "zeal-*-portable-windows-x64.*"
|
|
- name: Windows 11 ARM64
|
|
os: windows-11-arm
|
|
configurePreset: release
|
|
buildPreset: release
|
|
uploadPattern: "zeal-*-windows-arm64.msi"
|
|
- name: Windows 11 ARM64 / Portable
|
|
os: windows-11-arm
|
|
configurePreset: release-portable
|
|
buildPreset: release-portable
|
|
uploadPattern: "zeal-*-portable-windows-arm64.*"
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v6
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Prepare vcpkg
|
|
uses: lukka/run-vcpkg@v11
|
|
with:
|
|
vcpkgDirectory: ${{ github.workspace }}/.vcpkg
|
|
|
|
- name: Install Qt
|
|
uses: trollixx/setup-qt@v1
|
|
with:
|
|
version: ${{ env.QT_VERSION }}
|
|
modules: ${{ env.QT_MODULES }}
|
|
|
|
- name: Configure & Build
|
|
uses: lukka/run-cmake@v10
|
|
with:
|
|
configurePreset: ${{ matrix.config.configurePreset }}
|
|
buildPreset: ${{ matrix.config.buildPreset }}
|
|
configurePresetAdditionalArgs: "['-DVCPKG_DISABLE_COMPILER_TRACKING=ON']"
|
|
|
|
- name: Retrieve Application Version
|
|
run: |
|
|
$zeal_version = Get-Content build/${{ matrix.config.configurePreset }}/zeal_version
|
|
Write-Output "Zeal Version: $zeal_version"
|
|
"ZEAL_VERSION=$zeal_version" >> $env:GITHUB_ENV
|
|
|
|
- name: Install WiX
|
|
if: matrix.config.configurePreset == 'release'
|
|
run: |
|
|
dotnet tool install --global wix --version 5.0.2
|
|
wix extension add --global WixToolset.UI.wixext/5.0.2
|
|
wix extension add --global WixToolset.Util.wixext/5.0.2
|
|
|
|
- name: Log in to Azure
|
|
uses: azure/login@v3
|
|
with:
|
|
client-id: ${{ vars.AZURE_CLIENT_ID }}
|
|
tenant-id: ${{ vars.AZURE_TENANT_ID }}
|
|
subscription-id: ${{ vars.AZURE_SUBSCRIPTION_ID }}
|
|
|
|
- name: Install Trusted Signing client
|
|
shell: pwsh
|
|
run: |
|
|
$dir = Join-Path $env:RUNNER_TEMP 'trusted-signing-client'
|
|
New-Item -ItemType Directory -Force -Path $dir | Out-Null
|
|
nuget install Microsoft.Trusted.Signing.Client -OutputDirectory $dir -ExcludeVersion
|
|
$arch = if ("${{ runner.arch }}" -eq "ARM64") { "arm64" } else { "x64" }
|
|
$dlib = Get-ChildItem -Path $dir -Filter 'Azure.CodeSigning.Dlib.dll' -Recurse |
|
|
Where-Object { $_.FullName -match "[\\/]$arch[\\/]" } |
|
|
Select-Object -First 1 -ExpandProperty FullName
|
|
if (-not $dlib) {
|
|
throw "$arch Azure.CodeSigning.Dlib.dll not found in installed package."
|
|
}
|
|
"CODESIGN_AZURE_DLIB=$dlib" >> $env:GITHUB_ENV
|
|
|
|
- name: Package
|
|
run: cmake --build --preset ${{ matrix.config.buildPreset }} --target package
|
|
env:
|
|
CODESIGN_AZURE_ENDPOINT: ${{ vars.CODESIGN_AZURE_ENDPOINT }}
|
|
CODESIGN_AZURE_ACCOUNT: ${{ vars.CODESIGN_AZURE_ACCOUNT }}
|
|
CODESIGN_AZURE_PROFILE: ${{ vars.CODESIGN_AZURE_PROFILE }}
|
|
|
|
- name: Attest Build Provenance
|
|
uses: actions/attest@v4
|
|
with:
|
|
subject-path: build/${{ matrix.config.configurePreset }}/${{ matrix.config.uploadPattern }}
|
|
|
|
- name: Upload Release Assets
|
|
run: |
|
|
gh release upload ${{ github.ref_name }} --clobber `
|
|
build/${{ matrix.config.configurePreset }}/${{ matrix.config.uploadPattern }}
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
|
|
build-appimage:
|
|
name: AppImage
|
|
runs-on: ubuntu-24.04
|
|
permissions:
|
|
attestations: write
|
|
contents: write
|
|
id-token: write
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v6
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Install Dependencies
|
|
run: |
|
|
sudo apt-get -y -qq update
|
|
sudo apt-get -y -qq --no-install-recommends install \
|
|
appstream \
|
|
cmake \
|
|
extra-cmake-modules \
|
|
libarchive-dev \
|
|
libfuse2t64 \
|
|
libgl1-mesa-dev \
|
|
libqt6opengl6-dev \
|
|
libqt6svg6-dev \
|
|
libsqlite3-dev \
|
|
libvulkan-dev \
|
|
libxcb-keysyms1-dev \
|
|
ninja-build \
|
|
qt6-base-private-dev \
|
|
qt6-webengine-dev \
|
|
qt6-webengine-dev-tools
|
|
|
|
- name: Install linuxdeploy
|
|
run: |
|
|
wget -q https://github.com/linuxdeploy/linuxdeploy/releases/download/1-alpha-20251107-1/linuxdeploy-x86_64.AppImage
|
|
wget -q https://github.com/linuxdeploy/linuxdeploy-plugin-appimage/releases/download/1-alpha-20250213-1/linuxdeploy-plugin-appimage-x86_64.AppImage
|
|
wget -q https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/1-alpha-20250213-1/linuxdeploy-plugin-qt-x86_64.AppImage
|
|
chmod +x linuxdeploy*.AppImage
|
|
|
|
- name: Configure & Build
|
|
run: |
|
|
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=/usr
|
|
cmake --build build
|
|
|
|
- name: Retrieve Application Version
|
|
run: |
|
|
zeal_version=$(<build/zeal_version)
|
|
echo "Zeal Version: ${zeal_version}"
|
|
echo "ZEAL_VERSION=${zeal_version}" >> $GITHUB_ENV
|
|
|
|
- name: Prepare AppDir
|
|
run: DESTDIR=${{ github.workspace }}/AppDir cmake --install build
|
|
|
|
- name: Validate AppStream Metadata
|
|
run: appstreamcli validate AppDir/usr/share/metainfo/org.zealdocs.zeal.appdata.xml
|
|
|
|
- name: Set Up AppRun Hooks
|
|
run: |
|
|
mkdir -p AppDir/apprun-hooks
|
|
echo 'export QTWEBENGINE_DISABLE_SANDBOX=1' > AppDir/apprun-hooks/qtwebengine.sh
|
|
|
|
- name: Build AppImage
|
|
run: |
|
|
export QMAKE=$(which qmake6)
|
|
export OUTPUT=Zeal-${{ env.ZEAL_VERSION }}-x86_64.AppImage
|
|
export LDAI_UPDATE_INFORMATION="gh-releases-zsync|zealdocs|zeal|latest|Zeal-*x86_64.AppImage.zsync"
|
|
./linuxdeploy-x86_64.AppImage \
|
|
--appdir AppDir \
|
|
--plugin qt \
|
|
--output appimage
|
|
|
|
- name: Attest Build Provenance
|
|
uses: actions/attest@v4
|
|
with:
|
|
subject-path: Zeal-*.AppImage*
|
|
|
|
- name: Upload Release Assets
|
|
run: gh release upload ${{ github.ref_name }} --clobber Zeal-*.AppImage*
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
|
|
build-ubuntu:
|
|
name: ${{ matrix.config.name }}
|
|
runs-on: ${{ matrix.config.os }}
|
|
permissions:
|
|
attestations: write
|
|
contents: write
|
|
id-token: write
|
|
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
config:
|
|
- name: Ubuntu 24.04 / Source
|
|
os: ubuntu-24.04
|
|
qt_packages: >-
|
|
libgl1-mesa-dev
|
|
libqt6opengl6-dev
|
|
libqt6svg6-dev
|
|
qt6-base-private-dev
|
|
qt6-webengine-dev
|
|
qt6-webengine-dev-tools
|
|
configurePreset: release
|
|
buildPreset: release
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v6
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Install Dependencies
|
|
run: |
|
|
sudo apt-get -y -qq update
|
|
sudo apt-get -y -qq --no-install-recommends install \
|
|
cmake \
|
|
extra-cmake-modules \
|
|
libarchive-dev \
|
|
libsqlite3-dev \
|
|
libvulkan-dev \
|
|
libxcb-keysyms1-dev \
|
|
ninja-build \
|
|
${{ matrix.config.qt_packages }}
|
|
|
|
- name: Configure & Package Source
|
|
uses: lukka/run-cmake@v10
|
|
with:
|
|
configurePreset: ${{ matrix.config.configurePreset }}
|
|
buildPreset: ${{ matrix.config.buildPreset }}
|
|
buildPresetAdditionalArgs: "['--target package_source']"
|
|
|
|
- name: Attest Build Provenance
|
|
uses: actions/attest@v4
|
|
with:
|
|
subject-path: build/${{ matrix.config.configurePreset }}/zeal-*.*
|
|
|
|
- name: Upload Release Assets
|
|
run: gh release upload ${{ github.ref_name }} --clobber build/${{ matrix.config.configurePreset }}/zeal-*.*
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
|
|
publish:
|
|
name: Publish Release
|
|
needs: [build-windows, build-appimage, build-ubuntu]
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Generate App Token
|
|
id: app-token
|
|
if: github.repository == 'zealdocs/zeal'
|
|
uses: actions/create-github-app-token@v3
|
|
with:
|
|
client-id: ${{ secrets.CI_APP_ID }}
|
|
private-key: ${{ secrets.CI_APP_PRIVATE_KEY }}
|
|
permission-contents: write
|
|
|
|
- name: Publish Release
|
|
run: gh release edit ${{ github.ref_name }} --draft=false --discussion-category Announcements --repo ${{ github.repository }}
|
|
env:
|
|
GH_TOKEN: ${{ steps.app-token.outputs.token || github.token }}
|