forked from FAForever/client
-
Notifications
You must be signed in to change notification settings - Fork 0
155 lines (127 loc) · 5.16 KB
/
release.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
name: Release
on:
workflow_dispatch:
inputs:
version:
description: 'Release Version'
required: true
env:
UID_VERSION: v4.0.6
ICE_ADAPTER_VERSION: 3.3.9
BUILD_VERSION: ${{ github.event.inputs.version }}
jobs:
build-windows:
environment: deploy
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.12
cache: pip
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r win_requirements.txt
- name: Test with pytest
run: |
python runtests.py -vv --full-trace
- name: Download ICE adapter and UID calculator
run: |
mkdir build_setup\ice-adapter
Invoke-WebRequest -Uri "https://github.com/FAForever/uid/releases/download/$($env:UID_VERSION)/faf-uid.exe" -OutFile ".\\build_setup\\faf-uid.exe"
Invoke-WebRequest -Uri "https://github.com/FAForever/java-ice-adapter/releases/download/$($env:ICE_ADAPTER_VERSION)/faf-ice-adapter-$($env:ICE_ADAPTER_VERSION)-win.jar" -OutFile ".\\build_setup\\ice-adapter\\faf-ice-adapter.jar"
- name: Download JDK and create JRE
run: |
Invoke-WebRequest -Uri "https://download.oracle.com/java/21/latest/jdk-21_windows-x64_bin.zip" -OutFile ".\\windows-jdk.zip"
7z x windows-jdk.zip -ojdk
pushd jdk
mv $(ls) jdk
popd
$ICE_ADAPTER_JAVA_MODULES=((jdk/jdk/bin/jdeps.exe -s "build_setup/ice-adapter/faf-ice-adapter.jar" | findstr "java" | ForEach-Object { $_.split(" ")[2] }) -join ",")
jdk/jdk/bin/jlink.exe --add-modules "$ICE_ADAPTER_JAVA_MODULES,jdk.crypto.ec,jdk.unsupported" --strip-debug --no-man-pages --no-header-files --compress "zip-6" --output "build_setup/ice-adapter/jre"
- name: Build application
run: |
python setup.py bdist_msi
- name: Calculate checksum
id: checksum
run: |
$MSI_SUM = $(Get-FileHash dist/*).hash
Write-Host $MSI_SUM
echo "MSI_SUM=$MSI_SUM" >> "$env:GITHUB_ENV"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: client-windows
path: dist/*
build-linux:
runs-on: ubuntu-latest
environment: release
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.12
cache: pip
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
- name: Test with pytest
run: |
python runtests.py -vv --full-trace
- name: Download ICE adapter and UID calculator
run: |
mkdir -p build_setup/ice-adapter
wget -O build_setup/faf-uid "https://github.com/FAForever/uid/releases/download/$($env:UID_VERSION)/faf-uid"
chmod +x build_setup/faf-uid
wget "https://github.com//FAForever/java-ice-adapter/releases/download/$($env:ICE_ADAPTER_VERSION)/faf-ice-adapter-$($env:ICE_ADAPTER_VERSION)-win.jar" -O "build_setup/ice-adapter/faf-ice-adapter.jar"
- name: Download JDK and create JRE
wget -O "jdk.tar.gz" "https://download.oracle.com/java/21/latest/jdk-21_linux-x64_bin.tar.gz"
mkdir jdk
tar -xzvf jdk.tar.gz -C jdk --strip-components=1
ICE_ADAPTER_JAVA_MODULES=$(jdk/bin/jdeps -s build_setup/ice-adapter/faf-ice-adapter.jar | cut -d' ' -f 3 | grep java | xargs echo | tr ' ' ',')
jdk/bin/jlink --add-modules "$ICE_ADAPTER_JAVA_MODULES,jdk.crypto.ec,jdk.unsupported" --strip-debug --no-man-pages --no-header-files --compress "zip-6" --output "build_setup/ice-adapter/jre"
- name: Build application
run: |
python3 setup.py build
python3 post_setup.py
tar -C "build" -cvzf "faforever.tar.gz" "faf_python_client"
- name: Calculate checksum
id: checksum
run: |
TAR_SUM=$(echo faforever.tar.gz -n | sha256sum)
echo $TAR_SUM
echo "TAR_SUM=$TAR_SUM" >> "$env:GITHUB_ENV"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: client-linux
path: faforever.tar.gz
create-release:
needs: [build-windows, build-linux]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download Windows artifact
uses: actions/download-artifact@v4
with:
name: client-windows
path: release-artifacts/
- name: Download Linux artifact
uses: actions/download-artifact@v4
with:
name: client-linux
path: release-artifacts/
- name: Create draft release
id: create_release
uses: ncipollo/[email protected]
with:
commit: ${{ github.sha }}
tag: ${{ github.event.inputs.version }}
body: "SHA256 (Windows): ${{ env.MSI_SUM }}\nSHA256 (Linux): ${{ env.TAR_SUM }}"
draft: true
prerelease: true
artifacts: "release-artifacts/*"