-
-
Notifications
You must be signed in to change notification settings - Fork 4
214 lines (205 loc) · 7.58 KB
/
build.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
name: Build
on: [push, workflow_dispatch]
permissions: read-all
jobs:
delete-old-artifacts:
permissions:
actions: write
if: github.actor == 'calendulish'
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1
with:
egress-policy: audit
- uses: calendulish/purge-artifacts-action@2e8a85a677ea67a31edfe3e348d9379ad7e26988 # v1.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
expire-in: 0
linux-build:
if: ${{ always() }}
needs: delete-old-artifacts
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12']
name: Python ${{ matrix.python-version }} linux build
steps:
- name: Harden Runner
uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1
with:
egress-policy: audit
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: ${{ matrix.python-version }}
- run: sudo apt-fast -y install gettext
- run: python -m pip install -r requirements.txt
- run: python -m build
- uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: linux_${{ matrix.python-version }}
path: |
build/*.zip
dist/
if-no-files-found: error
retention-days: 90
if: github.actor == 'calendulish'
rpi-build:
if: ${{ always() }}
needs: delete-old-artifacts
runs-on: ubuntu-latest
name: Build ${{ matrix.arch }} ${{ matrix.python-version }}
strategy:
matrix:
include:
- arch: 'armv7'
distro: 'archarm_latest'
- arch: 'aarch64'
distro: 'archarm_latest'
steps:
- name: Harden Runner
uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1
with:
egress-policy: audit
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: uraimo/run-on-arch-action@b0ffb25eb00af00468375982384441f063da1741 # v2.7.2
id: build
with:
arch: ${{ matrix.arch }}
distro: ${{ matrix.distro }}
setup: mkdir -p "${PWD}/artifacts"
dockerRunArgs: --volume "${PWD}/artifacts:/artifacts"
env: |
release_name: "steam-tools-ng-RPI-${{ matrix.arch }}"
shell: /bin/sh
run: |
pacman -Syu --noconfirm
pacman -S --noconfirm python python-build tar
python -m build
cp -rfv dist/ /artifacts/
- uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: rpi_${{ matrix.arch }}
path: |
artifacts/dist/
if-no-files-found: error
retention-days: 90
if: github.actor == 'calendulish'
windows-build:
if: ${{ always() }}
needs: delete-old-artifacts
runs-on: windows-2022
strategy:
matrix:
python-version: ['3.10', '3.11', '3.12']
defaults:
run:
shell: cmd
working-directory: .\\tools\Windows
steps:
- name: Harden Runner
uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1
with:
egress-policy: audit
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: ${{ matrix.python-version }}
- run: python -m pip install -r .\\..\..\requirements.txt
- run: dist_script_native.cmd
- uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: windows_${{ matrix.python-version }}
path: |
build/*.zip
installer/build/*.exe
if-no-files-found: error
retention-days: 90
if: github.actor == 'calendulish'
deploy:
permissions:
contents: write
if: startsWith(github.ref, 'refs/tags/')
needs: [linux-build, windows-build, rpi-build]
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1
with:
egress-policy: audit
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
- uses: softprops/action-gh-release@e7a8f85e1c67a31e6ed99a94b41bd0b71bbee6b8 # v2.0.9
with:
draft: true
files: |
linux_3.12/dist/*
windows_3.12/installer/build/*.exe
windows_3.10/build/*.zip
windows_3.11/build/*.zip
windows_3.12/build/*.zip
rpi_aarch64/dist/*.whl
rpi_armv7/dist/*.whl
pypi-upload:
if: startsWith(github.ref, 'refs/tags/')
needs: [deploy]
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.12' ]
steps:
- name: Harden Runner
uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1
with:
egress-policy: audit
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
- uses: pypa/gh-action-pypi-publish@ec4db0b4ddc65acdf4bff5fa45ac92d78b56bdf0 # release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
packages_dir: linux_${{ matrix.python-version }}/dist/
verbose: true
print_hash: true
generate-badges:
permissions:
contents: write
if: ${{ always() && github.actor == 'calendulish' }}
needs: [linux-build, windows-build, rpi-build]
runs-on: ubuntu-latest
env:
linux-badge-color: ${{ needs.linux-build.result == 'success' && 'green' || 'red' }}
windows-badge-color: ${{ needs.windows-build.result == 'success' && 'green' || 'red' }}
rpi-badge-color: ${{ needs.rpi-build.result == 'success' && 'green' || 'red' }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1
with:
egress-policy: audit
- uses: RubbaBoy/BYOB@24f464284c1fd32028524b59607d417a2e36fee7 # v1.3.0
with:
NAME: steam-tools-ng-linux-build
LABEL: 'Linux build'
STATUS: ${{ needs.linux-build.result }}
COLOR: ${{ env.linux-badge-color }}
GITHUB_TOKEN: ${{ secrets.ACTIONS_TOKEN }}
REPOSITORY: calendulish/.github
ACTOR: calendulish
- uses: RubbaBoy/BYOB@24f464284c1fd32028524b59607d417a2e36fee7 # v1.3.0
with:
NAME: steam-tools-ng-windows-build
LABEL: 'Windows build'
STATUS: ${{ needs.windows-build.result }}
COLOR: ${{ env.windows-badge-color }}
GITHUB_TOKEN: ${{ secrets.ACTIONS_TOKEN }}
REPOSITORY: calendulish/.github
ACTOR: calendulish
- uses: RubbaBoy/BYOB@24f464284c1fd32028524b59607d417a2e36fee7 # v1.3.0
with:
NAME: steam-tools-ng-rpi-build
LABEL: 'RPI build'
STATUS: ${{ needs.rpi-build.result }}
COLOR: ${{ env.rpi-badge-color }}
GITHUB_TOKEN: ${{ secrets.ACTIONS_TOKEN }}
REPOSITORY: calendulish/.github
ACTOR: calendulish