-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
220 lines (209 loc) · 8.14 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
name: Love actions for Linux
description: Linux CI/CD for LÖVE based games
branding:
icon: "heart"
color: "orange"
inputs:
app-name:
description: |
App display name
Would be used in desktop file
required: false
default: "love"
description:
description: |
App description
Would be used in control file and desktop file
required: false
default: "love game"
icon-path:
description: |
Path to the icon, only supports png
Would be used in desktop file
required: false
love-ref:
description: |
Love release ref
Could only be release tags like '11.5'
required: false
default: "11.5"
love-package:
description: |
Love package
Would be used to assemble the executable
required: false
default: "./game.love"
lib-path:
description: |
Path to the lib folder
Would copy all contents
Top folder not included
required: false
share-path:
description: |
Path to the share folder
Would copy all contents
Top folder not included
required: false
build-deb:
description: |
Switch to control build deb package or not
required: false
default: "true"
bundle-id:
description: |
App bundle ID
Would be used to rename debian package's desktop file
required: false
default: "org.loveactions.love"
version-string:
description: |
App version string
Recommend using 3 numbers seperated by dots
Looks like 3.2.1
required: false
default: "11.5"
product-name:
description: |
Base name of the package
Would be used to rename products
required: false
default: "love_app"
output-folder:
description: |
Packages output folder
All packages would be placed here
required: false
default: "./build"
love-actions-folder:
description: |
Path to the love-actions-linux folder
Would be used to run all the action steps
required: false
default: "./love-actions-linux"
outputs:
package-paths:
description: |
Paths to the built packages in a bash list
Would be paths relative to repository root, separated by spaces
Looks like: ./build/game.AppImage
value: ${{ steps.gather-packages.outputs.package-paths }}
runs:
using: "composite"
steps:
- name: Create directories
shell: bash
run: |
mkdir -p ${{ inputs.love-actions-folder }}
mkdir -p ${{ inputs.output-folder }}
- name: Create appImage package
env:
APPIMAGE_TOOL_PATH: ./appimagetool.AppImage
LOVE_PACKAGE_PATH: ./love.AppImage
shell: bash
run: |
# Install dependencies
sudo add-apt-repository universe && sudo apt install libfuse2
# Download appImageKit and love base package
pushd ${{ inputs.love-actions-folder }}
curl -L --retry 5 https://github.com/AppImage/AppImageKit/releases/download/13/appimagetool-x86_64.AppImage -o ${{ env.APPIMAGE_TOOL_PATH }}
curl -L --retry 5 https://github.com/love2d/love/releases/download/${{ inputs.love-ref }}/love-${{ inputs.love-ref }}-x86_64.AppImage -o ${{ env.LOVE_PACKAGE_PATH }}
chmod a+x ${{ env.APPIMAGE_TOOL_PATH }}
chmod a+x ${{ env.LOVE_PACKAGE_PATH }}
${{ env.LOVE_PACKAGE_PATH }} --appimage-extract
popd
# Create desktop file
rm -f ${{ inputs.love-actions-folder }}/squashfs-root/love.desktop
cat > ${{ inputs.love-actions-folder }}/squashfs-root/${{ inputs.product-name }}.desktop << EOF
[Desktop Entry]
Name=${{ inputs.app-name }}
Comment=${{ inputs.description }}
Type=Application
Keywords=love;game;
MimeType=application/x-love-game;
Categories=Game;
Exec=${{ inputs.product-name }} %f
Icon=${{ inputs.product-name }}
Terminal=false
NoDisplay=false
EOF
# Assemble executable
echo "Assmebling executable..."
sed -i 's|bin/love|bin/${{ inputs.product-name }}|g' ${{ inputs.love-actions-folder }}/squashfs-root/AppRun
cat ${{ inputs.love-actions-folder }}/squashfs-root/bin/love ${{ inputs.love-package }} > ${{ inputs.love-actions-folder }}/squashfs-root/bin/${{ inputs.product-name }}
chmod +x ${{ inputs.love-actions-folder }}/squashfs-root/bin/${{ inputs.product-name }}
rm -f ${{ inputs.love-actions-folder }}/squashfs-root/bin/love
# Copy icon
if [ -f "${{ inputs.icon-path }}" ]; then
echo "Copying icon..."
rm -rf ${{ inputs.love-actions-folder }}/squashfs-root/love.svg ${{ inputs.love-actions-folder }}/squashfs-root/.DirIcon
ICON_PATH=$(basename -- "${{ inputs.icon-path }}")
cp ${{ inputs.icon-path }} "${{ inputs.love-actions-folder }}/squashfs-root/${{ inputs.product-name }}.${ICON_PATH##*.}"
cp ${{ inputs.icon-path }} ${{ inputs.love-actions-folder }}/squashfs-root/.DirIcon
fi
# Copy lib
if [ -d "${{ inputs.lib-path }}" ]; then
echo "Copying lib..."
mkdir -p ${{ inputs.love-actions-folder }}/squashfs-root/lib
cp -r -f ${{ inputs.lib-path }}/* ${{ inputs.love-actions-folder }}/squashfs-root/lib
fi
# Copy share
if [ -d "${{ inputs.share-path }}" ]; then
echo "Copying share..."
mkdir -p ${{ inputs.love-actions-folder }}/squashfs-root/share
cp -r -f ${{ inputs.share-path }}/* ${{ inputs.love-actions-folder }}/squashfs-root/share
fi
# Build appImage package
echo "Building appImage package..."
${{ inputs.love-actions-folder }}/appimagetool.AppImage ${{ inputs.love-actions-folder }}/squashfs-root ${{ inputs.output-folder }}/${{ inputs.product-name }}.AppImage
chmod a+x ${{ inputs.output-folder }}/${{ inputs.product-name }}.AppImage
- name: Create deb package
if: ${{ inputs.build-deb == 'true' }}
shell: bash
run: |
# Create control file
mkdir -p ${{ inputs.love-actions-folder }}/deb/DEBIAN
cat > ${{ inputs.love-actions-folder }}/deb/DEBIAN/control << EOF
Package: ${{ inputs.product-name }}
Version: ${{ inputs.version-string }}
Section: games
Priority: optional
Architecture: amd64
Maintainer: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
Description: ${{ inputs.description }}
EOF
# Create desktop file
mkdir -p ${{ inputs.love-actions-folder }}/deb/usr/share/applications
cat > ${{ inputs.love-actions-folder }}/deb/usr/share/applications/${{ inputs.bundle-id }}.desktop << EOF
[Desktop Entry]
Name=${{ inputs.app-name }}
Comment=${{ inputs.description }}
Type=Application
Keywords=love;game;
MimeType=application/x-love-game;
Categories=Game;
Exec=env DESKTOPINTEGRATION=no /usr/share/${{ inputs.product-name }}/${{ inputs.product-name }}.AppImage
Icon=${{ inputs.bundle-id }}
Terminal=false
NoDisplay=false
EOF
# Copy AppImage package
echo "Copying AppImage package..."
mkdir -p ${{ inputs.love-actions-folder }}/deb/usr/share/${{ inputs.product-name }}
cp ${{ inputs.output-folder }}/${{ inputs.product-name }}.AppImage \
${{ inputs.love-actions-folder }}/deb/usr/share/${{ inputs.product-name }}/${{ inputs.product-name }}.AppImage
# Copy icon
if [ -f "${{ inputs.icon-path }}" ]; then
echo "Copying icon..."
mkdir -p ${{ inputs.love-actions-folder }}/deb/usr/share/pixmaps
cp ${{ inputs.icon-path }} ${{ inputs.love-actions-folder }}/deb/usr/share/pixmaps/${{ inputs.bundle-id }}.png
fi
# Build deb package
echo "Building deb package..."
dpkg-deb -Zxz --build ${{ inputs.love-actions-folder }}/deb ${{ inputs.output-folder }}/${{ inputs.product-name }}.deb
chmod a+x ${{ inputs.output-folder }}/${{ inputs.product-name }}.deb
- name: Gather packages in output folder
id: gather-packages
shell: bash
run: |
echo "package-paths=$(ls -d ${{ inputs.output-folder }}/* | tr '\r\n' ' ')" >> $GITHUB_OUTPUT