-
Notifications
You must be signed in to change notification settings - Fork 0
158 lines (138 loc) · 5.71 KB
/
Copy pathrelease-windows.yml
File metadata and controls
158 lines (138 loc) · 5.71 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
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
name: Release Windows
on:
workflow_call:
outputs:
artifact-name:
value: ${{ jobs.windows.outputs.artifact-name }}
bundle-name:
value: ${{ jobs.windows.outputs.bundle-name }}
setup-name:
value: ${{ jobs.windows.outputs.setup-name }}
jobs:
windows:
name: Build Windows EXE
runs-on: windows-latest
outputs:
artifact-name: ${{ steps.names.outputs.artifact_name }}
bundle-name: ${{ steps.names.outputs.windows_name }}
setup-name: ${{ steps.names.outputs.setup_name }}
defaults:
run:
shell: msys2 {0}
steps:
- name: Check out sources
uses: actions/checkout@v4
- name: Read release metadata
id: names
shell: bash
run: |
set -euo pipefail
TAG="${GITHUB_REF_NAME}"
VERSION="${TAG#v}"
BASE_VERSION="${VERSION%%-*}"
CARGO_VERSION="$(
python -c 'import pathlib, tomllib; data = tomllib.loads(pathlib.Path("Cargo.toml").read_text()); print(data["workspace"]["package"]["version"])'
)"
if [ "$BASE_VERSION" != "$CARGO_VERSION" ]; then
echo "Tag ${TAG} does not match workspace version ${CARGO_VERSION}." >&2
exit 1
fi
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
echo "artifact_name=windows-bundle" >> "$GITHUB_OUTPUT"
echo "windows_name=aetheris-${VERSION}-windows-x86_64.zip" >> "$GITHUB_OUTPUT"
echo "setup_name=aetheris-${VERSION}-windows-x86_64-setup.exe" >> "$GITHUB_OUTPUT"
- name: Set up MSYS2
uses: msys2/setup-msys2@v2
with:
msystem: CLANG64
path-type: inherit
update: true
install: >-
git
gettext
mingw-w64-clang-x86_64-gtk4
mingw-w64-clang-x86_64-gtksourceview5
mingw-w64-clang-x86_64-libadwaita
mingw-w64-clang-x86_64-openssl
mingw-w64-clang-x86_64-pkg-config
mingw-w64-clang-x86_64-toolchain
zip
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-pc-windows-gnullvm
- name: Build Windows executable
run: |
set -euo pipefail
export PKG_CONFIG_ALLOW_CROSS=1
export PKG_CONFIG_PATH="/clang64/lib/pkgconfig"
export CARGO_TARGET_X86_64_PC_WINDOWS_GNULLVM_LINKER="clang"
cargo build --release --locked --target x86_64-pc-windows-gnullvm --bin aetheris
- name: Bundle Windows runtime
run: |
set -euo pipefail
bundle="target/windows/aetheris"
rm -rf "$bundle"
mkdir -p "$bundle/bin" "$bundle/share" "$bundle/lib" "$bundle/ssl/certs" dist
cp target/x86_64-pc-windows-gnullvm/release/aetheris.exe "$bundle/bin/aetheris.exe"
copy_deps() {
local binary="$1"
ldd "$binary" \
| awk '{ for (i = 1; i <= NF; i++) if ($i ~ /^\/clang64\//) print $i }' \
| sort -u \
| while read -r dep; do
local dest="$bundle/bin/$(basename "$dep")"
if [ ! -f "$dest" ]; then
cp "$dep" "$dest"
copy_deps "$dest"
fi
done
}
copy_deps "$bundle/bin/aetheris.exe"
cp -r /clang64/share/glib-2.0 "$bundle/share/" || true
cp -r /clang64/share/gtksourceview-5 "$bundle/share/" || true
cp -r /clang64/share/icons "$bundle/share/" || true
cp -r /clang64/share/themes "$bundle/share/" || true
mkdir -p "$bundle/share/aetheris"
cp data/style.css "$bundle/share/aetheris/style.css"
mkdir -p "$bundle/share/icons/hicolor/scalable/actions"
cp data/icons/hicolor/scalable/actions/*.svg "$bundle/share/icons/hicolor/scalable/actions/"
mkdir -p "$bundle/share/locale/pt_BR/LC_MESSAGES"
cp po/pt_BR/LC_MESSAGES/org.luminusos.Aetheris.mo "$bundle/share/locale/pt_BR/LC_MESSAGES/org.luminusos.Aetheris.mo"
cp -r /clang64/lib/gdk-pixbuf-2.0 "$bundle/lib/" || true
cp -r /clang64/lib/gio "$bundle/lib/" || true
cp /clang64/ssl/certs/ca-bundle.crt "$bundle/ssl/certs/" 2>/dev/null || true
cp /clang64/etc/ssl/certs/ca-bundle.crt "$bundle/ssl/certs/" 2>/dev/null || true
(
cd target/windows
zip -r "../../dist/${{ steps.names.outputs.windows_name }}" aetheris
)
- name: Install Inno Setup
shell: pwsh
run: |
choco install innosetup -y --no-progress
echo "C:\Program Files (x86)\Inno Setup 6" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Build Windows setup
shell: msys2 {0}
run: |
set -euo pipefail
source_dir="$(cygpath -w "$(pwd)/target/windows/aetheris")"
output_dir="$(cygpath -w "$(pwd)/dist")"
setup_icon_file="$(cygpath -w "$(pwd)/data/icons/windows/aetheris.ico")"
inno_script="$(cygpath -w "$(pwd)/build-aux/inno/aetheris.iss")"
MSYS2_ARG_CONV_EXCL='*' iscc \
"/DAppVersion=${{ steps.names.outputs.version }}" \
"/DSourceDir=${source_dir}" \
"/DOutputDir=${output_dir}" \
"/DTargetArch=x64" \
"/DSetupIconFile=${setup_icon_file}" \
"${inno_script}"
mv dist/aetheris-setup.exe "dist/${{ steps.names.outputs.setup_name }}"
- name: Upload release assets
uses: actions/upload-artifact@v4
with:
name: windows-bundle
path: |
dist/${{ steps.names.outputs.windows_name }}
dist/${{ steps.names.outputs.setup_name }}
retention-days: 1