-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
113 lines (100 loc) · 3.35 KB
/
action.yml
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
name: 'Create AppImage'
description: 'Creates an AppImage from binaries and resources'
inputs:
app-name:
description: 'Name of the application'
required: true
app-version:
description: 'Version of the application'
required: true
app-icon-name:
description: 'Name of the icon file (no extension)'
required: true
app-categories:
description: 'Comma-separated list of categories'
required: true
bin-paths:
description: 'Comma-separated paths to the binaries'
required: true
lib-paths:
description: 'Comma-separated paths to the libraries'
required: true
share-paths:
description: 'Comma-separated paths to the shared resources'
required: true
appdir-paths:
description: 'Comma-separated paths to other resources that go into the AppDir'
required: true
output-path:
description: 'Path to the output AppImage'
required: true
runs:
using: 'composite'
steps:
- name: Install dependencies
shell: bash
run: sudo apt-get install --assume-yes --quiet=2 libfuse2 appstream
- name: Create AppDir structure
shell: bash
run: |
mkdir -p build/AppDir/usr/bin
mkdir -p build/AppDir/usr/lib
mkdir -p build/AppDir/usr/share
copy_files_to_appdir() {
local IFS=$'\n'
local FILES_TO_COPY=($(echo "$1" | tr ',' '\n'))
for file in "${FILES_TO_COPY[@]}"; do
cp -r "$file" "$2"
done
}
set -e
copy_files_to_appdir "${{ inputs.bin-paths }}" "build/AppDir/usr/bin"
copy_files_to_appdir "${{ inputs.lib-paths }}" "build/AppDir/usr/lib"
copy_files_to_appdir "${{ inputs.share-paths }}" "build/AppDir/usr/share"
copy_files_to_appdir "${{ inputs.appdir-paths }}" "build/AppDir/"
- name: Create Desktop file
shell: bash
run: |
cat << EOF > build/AppDir/${{ inputs.app-name }}.desktop
[Desktop Entry]
Name=${{ inputs.app-name }}
Exec=${{ inputs.app-name }}
Icon=${{ inputs.app-icon-name }}
Type=Application
Categories=${{ inputs.app-categories }}
X-AppImage-Name=${{ inputs.app-name }}
X-AppImage-Version=${{ inputs.app-version }}
X-AppImage-Arch=x86-64
EOF
chmod a+x build/AppDir/${{ inputs.app-name }}.desktop
- name: Create AppRun file
shell: bash
run: |
cat << EOF > build/AppDir/AppRun
#!/bin/bash
HERE="\$(dirname "\$(readlink -f "\${0}")")"
export HERE
cd "\${HERE}/usr/bin"
exec "./${{ inputs.app-name }}"
EOF
chmod a+x build/AppDir/AppRun
- name: Debug output
run: |
tree build
echo Desktop:
cat build/AppDir/${{ inputs.app-name }}.desktop
echo
echo AppRun:
cat build/AppDir/AppRun
shell: bash
- name: Create AppImage
shell: bash
run: |
wget "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage" \
--directory-prefix build \
--quiet
chmod a+x build/appimagetool-x86_64.AppImage
ARCH=x86_64 ./build/appimagetool-x86_64.AppImage ./build/AppDir
DIR=$(dirname "${{ inputs.output-path }}")
mkdir --parents "${DIR}"
mv "${{ inputs.app-name }}-x86_64.AppImage" "${{ inputs.output-path }}"