-
-
Notifications
You must be signed in to change notification settings - Fork 8
240 lines (207 loc) · 8.6 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
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
name: Release
on:
milestone:
types: [closed]
workflow_call:
workflow_dispatch:
jobs:
draft:
name: Draft
runs-on: ubuntu-latest
permissions:
contents: write
discussions: write
steps:
- name: Date
id: date
run: |
CUR_DATE=`date +"%Y.%m.%d"`
echo "value=$CUR_DATE" >> "$GITHUB_OUTPUT"
- name: Title
id: title
env:
# https://docs.github.com/en/rest/issues/milestones?apiVersion=2022-11-28#get-a-milestone
TITLE: ${{ github.event_name == 'milestone' && format('{0} ({1})', github.event.milestone.title, steps.date.outputs.value) || steps.date.outputs.value }}
run: |
echo "value=$TITLE" >> "$GITHUB_OUTPUT"
- name: Page
id: release
uses: softprops/action-gh-release@v2
with:
draft: true
tag_name: ${{ (startsWith(github.ref, 'refs/tags/') && github.ref) || steps.date.outputs.value }}
name: ${{ steps.title.outputs.value }}
generate_release_notes: true
outputs:
url: ${{ steps.release.outputs.url }}
id: ${{ steps.release.outputs.id }}
upload_url: ${{ steps.release.outputs.upload_url }}
assets: ${{ steps.release.outputs.assets }}
build:
continue-on-error: true
name: Build
needs: draft
permissions:
contents: write
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- macos-14
- ubuntu-latest
- windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Deps
uses: ./.github/actions/tools-deps
- name: add target x86-64
if: runner.os == 'macOS'
continue-on-error: true
run: rustup target add x86_64-apple-darwin
- name: prepare names
id: names
shell: bash
run: |
echo "os=-${{ runner.os }}" >> "$GITHUB_OUTPUT"
echo "ext=${{ ((runner.os == 'Windows') && '.exe') || ' ' }}" >> "$GITHUB_OUTPUT"
echo "suffix=${{ (runner.os == 'Windows' && format('-{0}', runner.arch)) || format('-{0}-{1}', runner.os, runner.arch) }}" >> "$GITHUB_OUTPUT"
echo "full=${{ (runner.os == 'Windows' && format('-{0}.exe', runner.arch)) || format('-{0}-{1}', runner.os, runner.arch) }}" >> "$GITHUB_OUTPUT"
- name: prepare dir
shell: bash
run: mkdir -p target/upload
- name: symbolizer ${{ runner.os == 'macOS' && '(both targets)' || '' }}
id: symbolizer
continue-on-error: true
run: >-
cargo build --release -p=playdate-symbolize --bins
${{ runner.os == 'macOS' && '--target=x86_64-apple-darwin --target=aarch64-apple-darwin' || '' }}
- name: symbolizer to upload
if: steps.symbolizer.outcome == 'success' && runner.os != 'macOS'
shell: bash
run: |
cp target/release/pd-addr2line${{ steps.names.outputs.ext }} target/upload/pd-addr2line${{ steps.names.outputs.full }}
cp target/release/pd-symbolize-trace${{ steps.names.outputs.ext }} target/upload/pd-symbolize-trace${{ steps.names.outputs.full }}
cp target/release/pd-symbolize-crashlog${{ steps.names.outputs.ext }} target/upload/pd-symbolize-crashlog${{ steps.names.outputs.full }}
- name: pdtool ${{ runner.os == 'macOS' && '(both targets)' || '' }}
id: pdtool
continue-on-error: true
run: >-
cargo build --release --bin=pdtool
${{ runner.os == 'macOS' && '--target=x86_64-apple-darwin --target=aarch64-apple-darwin' || '' }}
- name: pdtool to upload
if: steps.pdtool.outcome == 'success' && runner.os != 'macOS'
shell: bash
run: cp target/release/pdtool${{ steps.names.outputs.ext }} target/upload/pdtool${{ steps.names.outputs.full }}
- name: bindgen
id: bindgen
continue-on-error: true
run: >-
cargo build --release --bin=pdbindgen --no-default-features
--features=cli,documentation,extra-codegen,logging,pretty-please,which-rustfmt,runtime
- name: bindgen to upload
if: steps.bindgen.outcome == 'success' && runner.os != 'macOS'
shell: bash
run: cp target/release/pdbindgen${{ steps.names.outputs.ext }} target/upload/pdbindgen${{ steps.names.outputs.full }}
- name: cargo
id: cargo
continue-on-error: true
run: cargo build --release --bin=cargo-playdate --all-features
- name: cargo to upload
if: steps.cargo.outcome == 'success' && runner.os != 'macOS'
shell: bash
run: cp target/release/cargo-playdate${{ steps.names.outputs.ext }} target/upload/cargo-playdate${{ steps.names.outputs.full }}
- name: merge universal
if: runner.os == 'macOS'
continue-on-error: true
run: |
lipo -create -output target/upload/pdtool${{ steps.names.outputs.os }} target/*/release/pdtool
lipo -create -output target/upload/pd-addr2line${{ steps.names.outputs.os }} target/*/release/pd-addr2line
lipo -create -output target/upload/pd-symbolize-trace${{ steps.names.outputs.os }} target/*/release/pd-symbolize-trace
lipo -create -output target/upload/pd-symbolize-crashlog${{ steps.names.outputs.os }} target/*/release/pd-symbolize-crashlog
- name: Upload Release Artifacts
uses: AButler/[email protected]
with:
release-id: ${{ needs.draft.outputs.id }}
repo-token: ${{ secrets.GITHUB_TOKEN }}
files: target/upload/*
- name: Upload for next jobs
if: runner.os == 'macOS'
uses: actions/upload-artifact@v4
with:
path: |
target/release/pdbindgen
target/release/cargo-playdate
if-no-files-found: warn
retention-days: 1
overwrite: false
build-universal:
continue-on-error: true
name: Build (macos-12)
needs: [build, draft]
permissions:
contents: write
runs-on: macos-12
steps:
- name: Checkout
uses: actions/checkout@v4
- name: prepare dir
run: |
mkdir -p target/upload
mkdir -p target/download
- name: Download artifacts
continue-on-error: true
uses: actions/download-artifact@v4
with:
path: target/download/
- name: ls download dir
run: ls -R target/download
- name: bindgen
id: bindgen
continue-on-error: true
run: >-
cargo build --release --bin=pdbindgen
--features=cli,documentation,extra-codegen,logging,pretty-please,which-rustfmt,runtime
--no-default-features
# fallback: if build fails => upload downloaded build:
- if: steps.bindgen.outcome == 'failure'
continue-on-error: true
name: bindgen to upload
run: mv target/download/*/pdbindgen target/upload/pdbindgen-${{ runner.os }}-ARM64
- name: cargo
id: cargo
continue-on-error: true
run: |
cargo build --release --bin=cargo-playdate --all-features
# fallback: if build fails => upload downloaded build:
- if: steps.cargo.outcome == 'failure'
continue-on-error: true
name: cargo to upload
run: mv target/download/*/cargo-playdate target/upload/cargo-playdate-${{ runner.os }}-ARM64
- name: merge pdbindgen
id: bindgen_merge
if: steps.bindgen.outcome == 'success'
continue-on-error: true
run: lipo -create -output target/upload/pdbindgen-${{ runner.os }} target/release/pdbindgen target/download/*/pdbindgen
# fallback: if merge fails or skipped => try upload new build:
- if: steps.bindgen_merge.outcome != 'success'
continue-on-error: true
name: cargo to upload
run: mv target/release/pdbindgen target/upload/pdbindgen-${{ runner.os }}-${{ runner.arch }}
- name: merge cargo-playdate
id: cargo_merge
if: steps.cargo.outcome == 'success'
continue-on-error: true
run: lipo -create -output target/upload/cargo-playdate-${{ runner.os }} target/release/cargo-playdate target/download/*/cargo-playdate
# fallback: if merge fails or skipped => try upload new build:
- if: steps.cargo_merge.outcome != 'success'
continue-on-error: true
name: cargo to upload
run: mv target/release/cargo-playdate target/upload/cargo-playdate-${{ runner.os }}-${{ runner.arch }}
- name: Upload Release Artifacts
uses: AButler/[email protected]
with:
release-id: ${{ needs.draft.outputs.id }}
repo-token: ${{ secrets.GITHUB_TOKEN }}
files: target/upload/*