-
Notifications
You must be signed in to change notification settings - Fork 0
116 lines (105 loc) · 3.97 KB
/
Copy pathrelease-appimage.yml
File metadata and controls
116 lines (105 loc) · 3.97 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
name: Release AppImage
on:
workflow_call:
outputs:
artifact-name:
value: ${{ jobs.appimage.outputs.artifact-name }}
appimage-name:
value: ${{ jobs.appimage.outputs.appimage-name }}
jobs:
appimage:
name: Build AppImage
runs-on: ubuntu-latest
container:
image: fedora:latest
outputs:
artifact-name: ${{ steps.names.outputs.artifact_name }}
appimage-name: ${{ steps.names.outputs.appimage_name }}
steps:
- name: Install system dependencies
run: |
dnf install -y \
appstream \
curl \
desktop-file-utils \
file \
findutils \
gcc \
gcc-c++ \
gettext \
git \
gtk4-devel \
gtksourceview5-devel \
libadwaita-devel \
make \
openssl-devel \
patchelf \
pkgconf-pkg-config \
vte291-gtk4-devel
- name: Check out sources
uses: actions/checkout@v4
- name: Read release metadata
id: names
run: |
set -euo pipefail
TAG="${GITHUB_REF_NAME}"
VERSION="${TAG#v}"
BASE_VERSION="${VERSION%%-*}"
CARGO_VERSION="$(
python3 -c 'import pathlib, tomllib; data = tomllib.loads(pathlib.Path("Cargo.toml").read_text()); print(data["workspace"]["package"]["version"])'
)"
APP_VERSION="$(
python3 -c 'import pathlib, tomllib; data = tomllib.loads(pathlib.Path("crates/aetheris-app/Cargo.toml").read_text()); print(data["package"]["version"])'
)"
if [ "$BASE_VERSION" != "$CARGO_VERSION" ]; then
echo "Tag ${TAG} does not match workspace version ${CARGO_VERSION}." >&2
exit 1
fi
if [ "$BASE_VERSION" != "$APP_VERSION" ]; then
echo "Tag ${TAG} does not match aetheris-app version ${APP_VERSION}." >&2
exit 1
fi
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
echo "artifact_name=appimage-bundle" >> "$GITHUB_OUTPUT"
echo "appimage_name=aetheris-${VERSION}-x86_64.AppImage" >> "$GITHUB_OUTPUT"
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Install AppImage tooling
run: |
set -euo pipefail
cargo install cargo-appimage
mkdir -p /usr/local/share/appimagetool
curl -fL \
"https://github.com/AppImage/appimagetool/releases/download/1.9.1/appimagetool-x86_64.AppImage" \
-o /usr/local/bin/appimagetool-bin
curl -fL \
"https://github.com/AppImage/type2-runtime/releases/download/continuous/runtime-x86_64" \
-o /usr/local/share/appimagetool/runtime-x86_64
chmod +x /usr/local/bin/appimagetool-bin /usr/local/share/appimagetool/runtime-x86_64
tee /usr/local/bin/appimagetool >/dev/null <<'EOF'
#!/usr/bin/env bash
set -euo pipefail
exec /usr/local/bin/appimagetool-bin --runtime-file /usr/local/share/appimagetool/runtime-x86_64 "$@"
EOF
chmod +x /usr/local/bin/appimagetool
- name: Build AppImage
run: |
set -euo pipefail
(
cd crates/aetheris-app
APPIMAGE_EXTRACT_AND_RUN=1 cargo appimage --locked
)
mkdir -p dist
generated="$(find . -type f -name '*.AppImage' ! -path './dist/*' -printf '%T@ %p\n' | sort -nr | head -1 | cut -d' ' -f2-)"
if [ -z "${generated}" ]; then
echo "cargo-appimage did not produce an AppImage." >&2
exit 1
fi
mv "${generated}" "dist/${{ steps.names.outputs.appimage_name }}"
chmod +x "dist/${{ steps.names.outputs.appimage_name }}"
- name: Upload release assets
uses: actions/upload-artifact@v4
with:
name: appimage-bundle
path: dist/${{ steps.names.outputs.appimage_name }}
retention-days: 1