1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132
|
# Template for running Ubuntu release jobs
on:
workflow_call:
inputs:
runner:
type: string
required: true
displayed_name:
type: string
required: true
build_appimage:
type: boolean
default: false
gcc_version:
default: '' # This means the package 'gcc'
type: string
extra_packages: # List of extra packages to be installed
type: string
default: ''
container_image: # if provided, runs in a container (docker...)
required: false
type: string
default: ''
head_sha: # SHA of the commit to build. Defaults to the head of the triggering event (cf github doc.)
type: string
default: ''
build_type:
type: string
default: 'RelWithDebInfo'
extra_cmake_flags:
type: string
default: ''
artifact_version_suffix: # Additional version string appended to 1.2.3+dev (for instance) in artifacts names
type: string
default: ''
outputs:
link:
description: URL of the produced installer
value: ${{ jobs.release-linux.outputs.link }}
link_appimage:
description: URL of the AppImage (if any)
value: ${{ jobs.release-linux.outputs.link_appimage }}
jobs:
release-linux:
name: Create installer for ${{ inputs.displayed_name }}
runs-on: ${{ inputs.runner }}
outputs:
link: ${{ steps.publish-packages.outputs.artifact-url }}
link_appimage: ${{ steps.publish-appimage.outputs.artifact-url }}
container:
image: ${{ inputs.container_image }}
steps:
- name: 'Checkout repository'
uses: actions/checkout@v4
with:
ref: ${{ inputs.head_sha }}
- name: 'Install dependencies (for AppImage)'
if: ${{ inputs.build_appimage }}
# Building the appimage requires extra packages (to add them to the appimage)
uses: ./.github/actions/install_deps_ubuntu
with:
gcc_version: ${{inputs.gcc_version}}
extra_packages: >-
${{ inputs.extra_packages }}
fcitx-frontend-gtk3
fcitx5-frontend-gtk3
gcin-gtk3-immodule
ibus-gtk3
uim-data
uim-gtk3-immodule
- name: 'Install dependencies (no AppImage)'
if: ${{ ! inputs.build_appimage }}
uses: ./.github/actions/install_deps_ubuntu
with:
gcc_version: ${{inputs.gcc_version}}
extra_packages: ${{ inputs.extra_packages }}
- name: 'Build Xournal++'
uses: ./.github/actions/build
with:
build_type: ${{ inputs.build_type }}
cmake_flags: >-
-DCMAKE_INSTALL_PREFIX=/usr
-DCPACK_GENERATOR="TGZ;DEB"
extra_cmake_flags: ${{ inputs.extra_cmake_flags }}
cmake_commands: '--target package'
- name: 'Rename assets'
if: ${{ inputs.artifact_version_suffix != '' }}
shell: bash
run: |
for f in build/packages/xournalpp-*; do
# If $artifact_version_suffix is `-foobar`, this transforms:
# * `xournalpp-2.3.4-` into `xournalpp-2.3.4-foobar-`
# * `xournalpp-2.3.4~dev-` into `xournalpp-2.3.4~dev-foobar-`
# * `xournalpp-2.3.4+dev-` into `xournalpp-2.3.4+dev-foobar-`
correct_name="$(echo "$f" | sed "s/xournalpp-\(\(\:\?\(\:\?[0-9]\+\.\)\+[0-9]\+\)\(\:\?[+~][^-]\+\)\?\)-/xournalpp-\1${{ inputs.artifact_version_suffix }}-/")"
echo "moving from $f to $correct_name"
mv "$f" "$correct_name" || exit 1
done
- name: 'Publish packages'
id: publish-packages
uses: actions/upload-artifact@v4
with:
name: "Packages ${{ inputs.displayed_name }} ${{ runner.arch }}"
compression-level: 0
path: "${{github.workspace}}/build/packages"
if-no-files-found: error
- name: 'Create AppImage'
id: build-appimage
if: ${{ inputs.build_appimage }}
shell: bash
run: |
# Build AppImage
export VERSION=$(cat VERSION | sed '1q;d')
export ARCH=$(cat VERSION | sed '4q;d')
export OUTPUT="xournalpp-$VERSION${{ inputs.artifact_version_suffix }}-$ARCH.AppImage"
../linux-setup/build_appimage.sh
mkdir appimage
mv "$OUTPUT" "$OUTPUT".zsync appimage/
echo "appimage-arch=$ARCH" >> "$GITHUB_OUTPUT"
working-directory: ./build
- name: 'Publish AppImage'
id: publish-appimage
if: ${{ inputs.build_appimage }}
uses: actions/upload-artifact@v4
with:
name: "Linux AppImage ${{ steps.build-appimage.outputs.appimage-arch }} (built on ${{ inputs.displayed_name }})"
compression-level: 0
path: "${{github.workspace}}/build/appimage"
if-no-files-found: error
|