forked from mchlnix/SMB3-Foundry
-
Notifications
You must be signed in to change notification settings - Fork 0
259 lines (216 loc) · 8.7 KB
/
publish.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
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
name: Publish
on: [push, pull_request]
jobs:
set_nightly_tag:
name: Set nightly tag on dev
if: startsWith(github.ref, 'refs/heads/dev')
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.GH_PAT }}
- name: Show all tags
run: git tag
- name: Set commit info
run: |
git config user.name "Automated Release"
git config user.email "automated@release.com"
- name: Remove old nightly tag
run: git tag --delete nightly || true
- name: Set new nightly tag
run: 'git tag --annotate nightly -m "+$(git rev-list --count origin/master..HEAD) commits
CAUTION: Nightlies are untested alpha releases. Most users should use ''$(git describe --tags --exclude=nightly --abbrev=0)''!
$(git log --format=''%an: %s (%h)'' origin/master..HEAD | grep -v ''Merge pull request'')"'
- name: Show created tag
run: |
git show nightly
- name: Remove remote tag
run: git push --delete origin nightly || true
- name: Push tag to remote
run: git push --tags
build_editor:
name: Build ${{ matrix.editor.name }}-${{ matrix.cfg.prefix }}
runs-on: ${{ matrix.cfg.os }}
strategy:
matrix:
cfg:
- {os: ubuntu-22.04, prefix: 'linux', suffix: '', architecture: 'x64'}
- {os: windows-2019, prefix: 'win64', suffix: '.exe', architecture: 'x64'}
- {os: macos-latest, prefix: 'osx', suffix: '', architecture: 'x64'}
editor:
- {name: 'smb3-foundry'}
- {name: 'smb3-scribe'}
steps:
- name: Check out
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.11"
architecture: ${{ matrix.cfg.architecture }}
- name: Display Python version
run: python -c "import sys; print(sys.version)"
- name: Get Dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
python -m pip install pyinstaller
- name: Ubuntu Only
if: ${{ matrix.cfg.prefix == 'linux' }}
run: |
sudo apt-get update
sudo apt-get install -y libegl1 libxcb-shape0 libqt5gui5
- name: Build Executable
run: |
pyinstaller ${{ matrix.editor.name }}.spec
mv dist/${{ matrix.editor.name }}${{ matrix.cfg.suffix }} dist/${{ matrix.cfg.prefix }}-${{ matrix.editor.name }}${{ matrix.cfg.suffix }}
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.cfg.prefix }}-${{ matrix.editor.name }}${{ matrix.cfg.suffix }}
path: dist/${{ matrix.cfg.prefix }}-${{ matrix.editor.name }}${{ matrix.cfg.suffix }}
build_manual:
name: Build Manual
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v3
- name: Get Dependencies
run: |
sudo apt-get update
sudo apt-get install pandoc texlive-latex-base texlive-fonts-recommended texlive-extra-utils texlive-latex-extra
- name: Build PDFs
run: |
pushd manual/foundry/
pandoc foundry-manual.md -o manual-foundry.pdf
popd
pushd manual/scribe/
pandoc scribe-manual.md -o manual-scribe.pdf
popd
- name: Upload Foundry Manual
uses: actions/upload-artifact@v2
with:
path: manual/foundry/manual-foundry.pdf
name: manual-foundry
- name: Upload Scribe Manual
uses: actions/upload-artifact@v2
with:
path: manual/scribe/manual-scribe.pdf
name: manual-scribe
# We're forced to create a separate publish job since the create-release
# action fails if it is run twice on the same tag. But we have multiple
# build systems (Windows, Linux, OSX) and only want one release.
publish:
needs: [build_editor, build_manual]
name: "Publish"
runs-on: ubuntu-latest # this doesn't matter as it's only codestyle and artifact collection
steps:
- name: Check out
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.11"
architecture: x64
- name: Set environment tag name
id: tag_name
run: echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/tags/}
- name: Set release information
id: release_info
run: |
echo ::set-output name=RELEASE_NAME::"$(git tag --format="%(body)" --points-at ${{ steps.tag_name.outputs.SOURCE_TAG }} | head -n 1)"
git tag --format="%(body)" --points-at ${{ steps.tag_name.outputs.SOURCE_TAG }}
echo ::set-output name=RELEASE_BODY::"$(git tag --format="%(body)" --points-at ${{ steps.tag_name.outputs.SOURCE_TAG }} | head -n +3)"
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: nightly
body: ${{ steps.release_info.outputs.RELEASE_BODY }}
draft: false
prerelease: ${{ steps.tag_name.outputs.SOURCE_TAG == 'nightly' }}
- name: Download All Artifacts
uses: actions/download-artifact@v2
with:
path: ./artifacts/
# upload-release-asset doesn't accept a directory or an array
# of files, so we must individually upload each one
- name: Upload SMB3 Foundry Linux
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: "artifacts/linux-smb3-foundry/linux-smb3-foundry"
asset_name: "linux-smb3-foundry"
asset_content_type: application/octet-stream
- name: Upload SMB3 Foundry OSX
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: "artifacts/osx-smb3-foundry/osx-smb3-foundry"
asset_name: "osx-smb3-foundry"
asset_content_type: application/octet-stream
- name: Upload SMB3 Foundry Windows x64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: "artifacts/win64-smb3-foundry.exe/win64-smb3-foundry.exe"
asset_name: "win64-smb3-foundry.exe"
asset_content_type: application/octet-stream
- name: Upload SMB3 Scribe Linux
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: "artifacts/linux-smb3-scribe/linux-smb3-scribe"
asset_name: "linux-smb3-scribe"
asset_content_type: application/octet-stream
- name: Upload SMB3 Scribe OSX
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: "artifacts/osx-smb3-scribe/osx-smb3-scribe"
asset_name: "osx-smb3-scribe"
asset_content_type: application/octet-stream
- name: Upload SMB3 Scribe Windows x64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: "artifacts/win64-smb3-scribe.exe/win64-smb3-scribe.exe"
asset_name: "win64-smb3-scribe.exe"
asset_content_type: application/octet-stream
- name: Upload SMB3 Foundry Manual
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: "artifacts/manual-foundry/manual-foundry.pdf"
asset_name: "manual-foundry.pdf"
asset_content_type: application/pdf
- name: Upload SMB3 Scribe Manual
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: "artifacts/manual-scribe/manual-scribe.pdf"
asset_name: "manual-scribe.pdf"
asset_content_type: application/pdf