-
-
Notifications
You must be signed in to change notification settings - Fork 0
119 lines (104 loc) · 4.43 KB
/
appimage.yml
File metadata and controls
119 lines (104 loc) · 4.43 KB
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
name: Build AppImage
on:
workflow_call:
inputs:
release_tag:
required: false
type: string
workflow_dispatch:
inputs:
release_tag:
description: 'Existing release tag to attach asset to (for manual runs)'
required: false
type: string
jobs:
build-appimage:
name: Build AppImage
runs-on: ubuntu-latest
env:
PROJECT_NAME: Workdir
PACKAGE_NAME: workdir
WORKSPACE_NAME: Workdir
ENTRYPOINT: src/workdir.py
ICON_FILE: icons/workdir.ico
APPDIR_ICON_SOURCE: icons/folder_open_48dp_8B1A10_FILL0_wght400_GRAD0_opsz48.png
APP_ID: io.github.dseichter.workdir
APP_DISPLAY_NAME: Workdir
DESKTOP_FILENAME: io.github.dseichter.workdir.desktop
steps:
- name: Resolve release tag
id: vars
env:
EVENT_NAME: ${{ github.event_name }}
INPUT_RELEASE_TAG: ${{ inputs.release_tag }}
run: |
TAG=""
if { [ "$EVENT_NAME" = "workflow_dispatch" ] || [ "$EVENT_NAME" = "workflow_call" ]; } && [ -n "$INPUT_RELEASE_TAG" ]; then
TAG="$INPUT_RELEASE_TAG"
fi
if [ "$EVENT_NAME" = "push" ] && [ "${GITHUB_REF_TYPE}" = "tag" ]; then
TAG="${GITHUB_REF_NAME}"
fi
if [ -z "$TAG" ] || [[ ! "$TAG" =~ ^v[0-9A-Za-z._-]+$ ]]; then
echo "A valid tag (e.g. v2026.3.1) is required." >&2
exit 1
fi
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: ${{ steps.vars.outputs.tag }}
- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
with:
python-version: '3.14'
- name: Install build dependencies
run: |
sudo apt-get update
sudo apt-get install -y libfuse2 patchelf desktop-file-utils
python -m pip install --upgrade pip
python -m pip install -r src/requirements.txt
- name: Build Linux binary
run: |
pyinstaller --onefile "${{ env.ENTRYPOINT }}" -n "${{ env.PACKAGE_NAME }}" --icon="${{ env.ICON_FILE }}"
- name: Prepare AppDir
run: |
mkdir -p AppDir/usr/bin
mkdir -p AppDir/usr/share/applications
mkdir -p AppDir/usr/share/icons/hicolor/256x256/apps
install -Dm755 "dist/${{ env.PACKAGE_NAME }}" "AppDir/usr/bin/${{ env.PACKAGE_NAME }}"
install -Dm644 "${{ env.APPDIR_ICON_SOURCE }}" "AppDir/usr/share/icons/hicolor/256x256/apps/${{ env.APP_ID }}.png"
cat > "AppDir/usr/share/applications/${{ env.DESKTOP_FILENAME }}" << EOF
[Desktop Entry]
Type=Application
Name=${{ env.APP_DISPLAY_NAME }}
Exec=${{ env.PACKAGE_NAME }}
Icon=${{ env.APP_ID }}
Categories=Utility;Development;
Terminal=false
EOF
install -Dm644 "AppDir/usr/share/applications/${{ env.DESKTOP_FILENAME }}" "AppDir/${{ env.DESKTOP_FILENAME }}"
install -Dm644 "AppDir/usr/share/icons/hicolor/256x256/apps/${{ env.APP_ID }}.png" "AppDir/${{ env.APP_ID }}.png"
cat > AppDir/AppRun << 'EOF'
#!/bin/sh
exec "$APPDIR/usr/bin/${{ env.PACKAGE_NAME }}" "$@"
EOF
chmod +x AppDir/AppRun
- name: Build AppImage
env:
RELEASE_TAG: ${{ steps.vars.outputs.tag }}
run: |
wget -q https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage
chmod +x appimagetool-x86_64.AppImage
ARCH=x86_64 ./appimagetool-x86_64.AppImage AppDir "${{ env.PACKAGE_NAME }}-appimage-${RELEASE_TAG}-x86_64.AppImage"
- name: Upload AppImage artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: ${{ env.PACKAGE_NAME }}-appimage-${{ steps.vars.outputs.tag }}-x86_64
path: ${{ env.PACKAGE_NAME }}-appimage-${{ steps.vars.outputs.tag }}-x86_64.AppImage
- name: Upload AppImage to Release
uses: softprops/action-gh-release@b4309332981a82ec1c5618f44dd2e27cc8bfbfda # v3.0.0
with:
tag_name: ${{ steps.vars.outputs.tag }}
prerelease: ${{ contains(steps.vars.outputs.tag, 'rc') || contains(steps.vars.outputs.tag, 'beta') }}
files: ${{ env.PACKAGE_NAME }}-appimage-${{ steps.vars.outputs.tag }}-x86_64.AppImage