-
Notifications
You must be signed in to change notification settings - Fork 3
237 lines (208 loc) · 8.23 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
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
name: Generate executables and post them to release
on:
push:
tags:
- "cli-*"
workflow_dispatch:
permissions:
contents: write
jobs:
generate-windows-executables:
name: Build & publish for ${{ matrix.target }}
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
target:
- x86_64-pc-windows-msvc
- aarch64-pc-windows-msvc
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install cross-compilation tools
uses: taiki-e/setup-cross-toolchain-action@v1
with:
target: ${{ matrix.target }}
- name: Install toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
targets: ${{ matrix.target }}
- name: Get flowupdater-json-creator version
id: flowupdater_json_creator_version
shell: pwsh
run: |
$version = (Get-Content .\projects\cli\Cargo.toml | Select-String -Pattern '^\s*version\s*=\s*"(\d+\.\d+\.\d+)"' | ForEach-Object { $_.Matches.Groups[1].Value })
echo "APP_VERSION=$version" >> $env:GITHUB_OUTPUT
- name: Set up cargo cache
uses: actions/cache@v3
continue-on-error: false
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
- name: Build release
run: |
cargo build --bin flowupdater-json-creator --release --locked --target ${{ matrix.target }}
mv ./target/${{ matrix.target }}/release/flowupdater-json-creator.exe ./flowupdater-json-creator-${{ steps.flowupdater_json_creator_version.outputs.APP_VERSION }}-${{ matrix.target }}.exe
- name: Upload executable to release
uses: softprops/action-gh-release@v1
with:
files: flowupdater-json-creator-${{ steps.flowupdater_json_creator_version.outputs.APP_VERSION }}-${{ matrix.target }}.exe
tag_name: ${{ steps.flowupdater_json_creator_version.outputs.APP_VERSION }}
generate-linux-freebsd-executables:
name: Build & publish for ${{ matrix.target }}
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
rust:
- stable
target:
- x86_64-unknown-freebsd
- i686-unknown-freebsd
- aarch64-unknown-linux-gnu
- arm-unknown-linux-gnueabi
- armv7-unknown-linux-gnueabi
- armv7-unknown-linux-gnueabihf
- i586-unknown-linux-gnu
- i686-unknown-linux-gnu
- mips-unknown-linux-gnu
- mips64-unknown-linux-gnuabi64
- mips64el-unknown-linux-gnuabi64
- mipsel-unknown-linux-gnu
- powerpc-unknown-linux-gnu
- powerpc64-unknown-linux-gnu
- powerpc64le-unknown-linux-gnu
- x86_64-unknown-linux-gnu
- i686-unknown-linux-musl
- aarch64-unknown-linux-musl
- arm-unknown-linux-musleabi
- arm-unknown-linux-musleabihf
- armv5te-unknown-linux-musleabi
- armv7-unknown-linux-musleabi
- armv7-unknown-linux-musleabihf
- i586-unknown-linux-musl
- mips-unknown-linux-musl
- mips64-unknown-linux-muslabi64
- mips64el-unknown-linux-muslabi64
- mipsel-unknown-linux-musl
- x86_64-unknown-linux-musl
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install Rust
run: rustup update ${{ matrix.rust }} && rustup default ${{ matrix.rust }}
- name: Install cross-compilation tools
uses: taiki-e/setup-cross-toolchain-action@v1
with:
target: ${{ matrix.target }}
- name: Set up cargo cache
uses: actions/cache@v3
continue-on-error: false
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
- name: Get flowupdater-json-creator version
id: flowupdater_json_creator_version
run: echo "APP_VERSION=$(awk -F ' = ' '$1 ~ /version/ { gsub(/["]/, "", $2); printf("%s",$2) }' projects/cli/Cargo.toml)" >> $GITHUB_OUTPUT
- name: Build release
run: |
cargo build --bin flowupdater-json-creator --release --locked --target ${{ matrix.target }}
mv ./target/${{ matrix.target }}/release/flowupdater-json-creator ./flowupdater-json-creator-${{ steps.flowupdater_json_creator_version.outputs.APP_VERSION }}-${{ matrix.target }}
- name: Upload executable to release
uses: softprops/action-gh-release@v1
with:
files: flowupdater-json-creator-${{ steps.flowupdater_json_creator_version.outputs.APP_VERSION }}-${{ matrix.target }}
tag_name: ${{ steps.flowupdater_json_creator_version.outputs.APP_VERSION }}
generate-macos-executables:
name: Build & publish for ${{ matrix.target }}
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
target:
- x86_64-apple-darwin
- aarch64-apple-darwin
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
targets: ${{ matrix.target }}
- name: Install cross-compilation tools
uses: taiki-e/setup-cross-toolchain-action@v1
with:
target: ${{ matrix.target }}
- name: Get flowupdater-json-creator version
id: flowupdater_json_creator_version
run: echo "APP_VERSION=$(awk -F ' = ' '$1 ~ /version/ { gsub(/["]/, "", $2); printf("%s",$2) }' projects/cli/Cargo.toml)" >> $GITHUB_OUTPUT
- name: Set up cargo cache
uses: actions/cache@v3
continue-on-error: false
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
- name: Build release
run: |
cargo build --bin flowupdater-json-creator --release --locked --target ${{ matrix.target }}
mv ./target/${{ matrix.target }}/release/flowupdater-json-creator ./flowupdater-json-creator-${{ steps.flowupdater_json_creator_version.outputs.APP_VERSION }}-${{ matrix.target }}
- name: Upload executable to release
uses: softprops/action-gh-release@v1
with:
files: flowupdater-json-creator-${{ steps.flowupdater_json_creator_version.outputs.APP_VERSION }}-${{ matrix.target }}
tag_name: ${{ steps.flowupdater_json_creator_version.outputs.APP_VERSION }}
create_changelog:
name: Generate changelog
runs-on: ubuntu-latest
steps:
- name: Get previous tag
id: previous_tag
run: echo "previous_tag=$(git describe --tags --abbrev=0 2>/dev/null || echo '')" >> $GITHUB_ENV
- name: Github Release Changelog Generator
uses: jaywcjlove/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
filter: '[R|r]elease[d]\s+[v|V]\d(\.\d+){0,2}'
custom-emoji: "feat⭐,fix🐞,docs📖,chore💄,style🎨,type🆎,test⛑️,refactor🐝,website🌍,revert🔙,clean💊,perf📈,ci💢,build⛽"
template: |
## Bugs
{{fix}}
## Feature
{{feat}}
## Improve
{{refactor,perf,clean}}
## Misc
{{chore,style,ci||🔶 Nothing change}}
## Unknown
{{__unknown__}}
- name: Get the changelog
run: echo "${{ steps.changelog.outputs.changelog }}"
- name: Update release
id: update_release
uses: tubone24/[email protected]
env:
GITHUB_TOKEN: ${{ github.token }}
with:
body: |
${{ steps.changelog.outputs.compareurl }}
${{ steps.changelog.outputs.changelog }}