-
Notifications
You must be signed in to change notification settings - Fork 36
184 lines (153 loc) · 5.89 KB
/
release-launcher.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
name: Release Launcher
on:
workflow_dispatch:
env:
python_version: '3.12'
jobs:
build-matrix:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ 'windows-2019', 'ubuntu-20.04', 'macos-13', 'macos-14' ]
include:
- os: 'windows-2019'
artifact-name: 'launcher-windows-amd64'
move-command: 'Move-Item -Path .\dist\__main__.exe -Destination .\dist\launch.exe'
zip-command: 'Compress-Archive -Path .\dist\launch.exe -DestinationPath .\dist\ZenithProxy-launcher-windows-amd64.zip'
sha1-command: '(Get-FileHash -Path dist\launch.exe -Algorithm sha1).Hash.ToLower()'
- os: 'ubuntu-20.04'
artifact-name: 'launcher-linux-amd64'
move-command: 'mv dist/__main__ dist/launch'
zip-command: 'zip -j dist/ZenithProxy-launcher-linux-amd64.zip dist/launch'
sha1-command: 'sha1sum -b dist/launch | cut -d" " -f 1'
- os: 'macos-13'
artifact-name: 'launcher-macos-amd64'
move-command: 'mv dist/__main__ dist/launch'
zip-command: 'zip -j dist/ZenithProxy-launcher-macos-amd64.zip dist/launch'
sha1-command: 'shasum dist/launch | cut -d" " -f 1'
- os: 'macos-14'
artifact-name: 'launcher-macos-aarch64'
move-command: 'mv dist/__main__ dist/launch'
zip-command: 'zip -j dist/ZenithProxy-launcher-macos-aarch64.zip dist/launch'
sha1-command: 'shasum dist/launch | cut -d" " -f 1'
steps:
- name: Check out repository
uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ env.python_version }}
- name: Install PyInstaller
run: |
pip install -U pyinstaller
pip install -r ./src/launcher/requirements.txt
- name: Build launcher
run: >
pyinstaller --specpath ./build
-p ./src/launcher --onefile --noconfirm
-i ../src/launcher/icon.ico
./src/launcher/__main__.py
- name: Rename executable
run: |
${{ matrix.move-command }}
- name: Create zip
run: |
${{ matrix.zip-command }}
- name: Upload Binary
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact-name }}
path: dist/ZenithProxy-${{ matrix.artifact-name }}.zip
- name: Get Binary Hash
run: ${{ matrix.sha1-command }} > ZenithProxy-${{ matrix.artifact-name }}.sha1
- name: Upload Launcher Hash Version
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact-name }}.sha1
path: ZenithProxy-${{ matrix.artifact-name }}.sha1
build-linux-aarch64:
runs-on: 'ubuntu-latest'
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build binary on emulated aarch64
run: |
docker run --rm --platform linux/arm64 --volume "${PWD}:/repo" python:${{ env.python_version }}-bullseye /bin/sh -c " \
cd /repo && \
python3 -m pip install -U pyinstaller && \
python3 -m pip install -r ./src/launcher/requirements.txt && \
pyinstaller --specpath ./build -p ./src/launcher --onefile --noconfirm ./src/launcher/__main__.py
"
- name: Rename executable
run: |
sudo mv dist/__main__ dist/launch
- name: Elevate binary permissions
run: sudo chmod +x dist/launch
- name: Create zip
run: sudo zip -j dist/ZenithProxy-launcher-linux-aarch64.zip dist/launch
- name: Upload Binary
uses: actions/upload-artifact@v4
with:
name: launcher-linux-aarch64
path: dist/ZenithProxy-launcher-linux-aarch64.zip
- name: Get Binary Hash
run: sha1sum -b dist/launch | cut -d" " -f 1 > ZenithProxy-launcher-linux-aarch64.sha1
- name: Upload Launcher Hash Version
uses: actions/upload-artifact@v4
with:
name: launcher-linux-aarch64.sha1
path: ZenithProxy-launcher-linux-aarch64.sha1
package-python:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Create Python executable zip
run: zip -j launcher-py.zip src/launcher/*.py
- name: Elevate script permissions
run: |
chmod +x src/launcher/launch.sh
- name: Create release zip
run: zip -j ZenithProxy-launcher-python.zip launcher-py.zip src/launcher/requirements.txt src/launcher/launch.sh src/launcher/launch.bat
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: launcher-python
path: ZenithProxy-launcher-python.zip
- name: Get Binary Hash
run: sha1sum -b launcher-py.zip | cut -d" " -f 1 > ZenithProxy-launcher-python.sha1
- name: Upload Launcher Hash Version
uses: actions/upload-artifact@v4
with:
name: launcher-python.sha1
path: ZenithProxy-launcher-python.sha1
release-artifacts:
needs:
- build-matrix
- build-linux-aarch64
- package-python
runs-on: ubuntu-latest
steps:
- name: Download job artifacts
uses: actions/download-artifact@v4
with:
merge-multiple: true
path: artifacts/
- name: Compile Hashes
run: |
cat artifacts/*.sha1 > hashes.txt
- name: Publish Release Artifacts
uses: ncipollo/release-action@v1
with:
tag: "launcher-v3"
artifacts: "artifacts/*.zip,hashes.txt"
name: "Launcher V3"
allowUpdates: true
replacesArtifacts: true
omitBodyDuringUpdate: true
removeArtifacts: true
makeLatest: true