-
Notifications
You must be signed in to change notification settings - Fork 0
206 lines (173 loc) · 5.16 KB
/
bugbite-cli.yml
File metadata and controls
206 lines (173 loc) · 5.16 KB
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
name: bugbite-cli
on:
push:
tags: [bugbite-cli-*]
branches: ['**']
paths:
- ".github/workflows/bugbite-cli.yml"
workflow_dispatch:
jobs:
man:
runs-on: ubuntu-latest
container:
image: asciidoctor/docker-asciidoctor
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build docs
run: make -C doc man
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: man
path: target/doc/cli/man
if-no-files-found: error
retention-days: 3
msrv:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.msrv.outputs.version }}
steps:
- name: Checkout code to determine the minimum supported rust version
uses: actions/checkout@v4
- name: Get the minimum supported rust version (MSRV)
id: msrv
run: |
min_ver=$(sed -rn '/^rust-version\s*=/ s/^.*=\s*"([0-9](\.[0-9]+)+)(.*)/\1/p' Cargo.toml)
if [[ -n ${min_ver} ]]; then
echo "version=${min_ver}" >> $GITHUB_OUTPUT
else
exit 1
fi
shellcomp:
needs: msrv
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ needs.msrv.outputs.version }}
- name: Generate files
run: cargo run --features shell --bin bite-shell-comp -p bugbite-cli
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: shellcomp
path: shell
if-no-files-found: error
retention-days: 3
source:
if: startsWith(github.ref, 'refs/tags/')
needs: [man, shellcomp, msrv]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ needs.msrv.outputs.version }}
- name: Create vendored release
run: .ci/vendor-release bugbite-cli
- name: Download generated man pages
uses: actions/download-artifact@v4
with:
name: man
path: man
- name: Download generated shell completion
uses: actions/download-artifact@v4
with:
name: shellcomp
path: shell
- name: Create archive
run: |
# move shell completion files into the release
mv man shell ${{ github.ref_name }}
# create the release tarball
tar -cv -I "xz -9 -T0" -f ${{ github.ref_name }}.tar.xz ${{ github.ref_name }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: source
path: ${{ github.ref_name }}.tar.xz
if-no-files-found: error
retention-days: 3
linux:
needs: msrv
runs-on: ubuntu-22.04
strategy:
matrix:
target:
- aarch64-unknown-linux-gnu
- aarch64-unknown-linux-musl
- powerpc64-unknown-linux-gnu
- powerpc64le-unknown-linux-gnu
- x86_64-unknown-linux-gnu
- x86_64-unknown-linux-musl
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ needs.msrv.outputs.version }}
- name: Install cross
run: cargo install cross --git https://github.com/cross-rs/cross
- name: Build binary
run: cross build --target ${{ matrix.target }} --profile release-strip -p bugbite-cli
- name: Create archive
run: |
tar -C target/${{ matrix.target }}/release-strip \
-cv -I "xz -9 -T0" -f ${{ github.ref_name }}-${{ matrix.target }}.tar.xz \
bite
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ github.ref_name }}-${{ matrix.target }}
path: ${{ github.ref_name }}-${{ matrix.target }}.tar.xz
if-no-files-found: error
retention-days: 3
macos:
needs: msrv
runs-on: macos-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ needs.msrv.outputs.version }}
- name: Build binary
run: cargo build --profile release-strip -p bugbite-cli
- name: Create archive
run: |
cd target/release-strip
zip $GITHUB_WORKSPACE/${{ github.ref_name }}-macos.zip bite
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ github.ref_name }}-macos
path: ${{ github.ref_name }}-macos.zip
if-no-files-found: error
retention-days: 3
publish:
if: startsWith(github.ref, 'refs/tags/')
needs: ["source", "linux", "macos"]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true
- name: Create GitHub release
uses: softprops/action-gh-release@v2
with:
files: |
artifacts/*.tar.xz
artifacts/${{ github.ref_name }}-macos.zip
fail_on_unmatched_files: true