@@ -9,106 +9,65 @@ permissions:
9
9
contents : write
10
10
11
11
jobs :
12
- build :
13
- name : build
14
- runs-on : ${{ matrix.os }}
15
- env :
16
- CARGO : cargo
17
- # Emit backtraces on panics.
18
- RUST_BACKTRACE : 1
19
- strategy :
20
- fail-fast : false
21
- matrix :
22
- include :
23
- - build : linux
24
- os : ubuntu-latest
25
- rust : stable
26
- target : x86_64-unknown-linux-gnu
27
- - build : macos
28
- os : macos-latest
29
- rust : stable
30
- target : x86_64-apple-darwin
31
- - build : macos
32
- os : macos-latest
33
- rust : stable
34
- target : aarch64-apple-darwin
35
- - build : win64-msvc
36
- os : windows-latest
37
- rust : stable-x86_64-gnu
38
- target : x86_64-pc-windows-msvc
39
- - build : win64-gnu
40
- os : windows-latest
41
- rust : stable
42
- target : x86_64-pc-windows-gnu
43
-
12
+ publish_crates :
13
+ name : Release
14
+ runs-on : ubuntu-latest
15
+ continue-on-error : true
16
+ if : github.ref_type == 'tag'
17
+ steps :
18
+ - name : Checkout
19
+ uses : actions/checkout@v4
20
+ - name : Install stable
21
+ uses : actions-rs/toolchain@v1
22
+ with :
23
+ toolchain : stable
24
+ - name : Publish
25
+ env :
26
+ TOKEN : ${{ secrets.CRATES_IO_TOKEN }}
27
+ run : |
28
+ cargo login $TOKEN
29
+ cargo publish --allow-dirty
30
+
31
+ archive :
32
+ name : Archive
33
+ runs-on : ubuntu-latest
34
+ continue-on-error : true
44
35
steps :
45
36
- name : Checkout repository
46
37
uses : actions/checkout@v4
47
38
48
- - name : Install Rust
49
- uses : actions-rs/toolchain@v1
50
- with :
51
- toolchain : ${{ matrix.rust }}
52
- target : ${{ matrix.target }}
53
-
54
- - name : Build applications
55
- shell : bash
56
- run : |
57
- CARGO_PROFILE_RELEASE_STRIP=symbols ${{ env.CARGO }} build \
58
- --verbose \
59
- --target ${{ matrix.target }} \
60
- --all-features \
61
- --release \
62
- -p cggtts-cli
63
- ls -lah target/${{ matrix.target }}/release
64
- if [ "${{ matrix.os }}" = "windows-latest" ]; then
65
- bin="target/${{ matrix.target }}/release/cggtts-cli.exe"
66
- else
67
- bin="target/${{ matrix.target }}/release/cggtts-cli"
68
- fi
69
- echo "BIN=$bin" >> $GITHUB_ENV
70
-
71
39
- name : Determine archive name
72
40
shell : bash
73
41
run : |
74
- echo "ARCHIVE=cggtts-cli- ${{ github.ref_name }}-${{ matrix.target }}" >> $GITHUB_ENV
42
+ echo "ARCHIVE=cggtts-${{ github.ref_name }}" >> $GITHUB_ENV
75
43
76
44
- name : Creating directory for archive
77
45
shell : bash
78
46
run : |
79
47
mkdir -p "$ARCHIVE"
80
- cp "$BIN" "$ARCHIVE"/
81
- cp {README.md,LICENSE-MIT,LICENSE-APACHE} "$ARCHIVE"/
48
+ cp {README.md,LICENSE} "$ARCHIVE"
82
49
83
50
- name : Gzip archive (Unix)
84
51
shell : bash
85
- if : matrix.os != 'windows-latest'
86
52
run : |
87
53
tar czf "$ARCHIVE.tar.gz" "$ARCHIVE"
88
54
shasum -a 256 "$ARCHIVE.tar.gz" > "$ARCHIVE.tar.gz.sha256"
89
55
echo "ASSET=$ARCHIVE.tar.gz" >> $GITHUB_ENV
90
56
echo "ASSET_SUM=$ARCHIVE.tar.gz.sha256" >> $GITHUB_ENV
91
57
92
- - name : Zip archive (Windows)
93
- shell : bash
94
- if : matrix.os == 'windows-latest'
95
- run : |
96
- 7z a "$ARCHIVE.zip" "$ARCHIVE"
97
- certutil -hashfile "$ARCHIVE.zip" SHA256 > "$ARCHIVE.zip.sha256"
98
- echo "ASSET=$ARCHIVE.zip" >> $GITHUB_ENV
99
- echo "ASSET_SUM=$ARCHIVE.zip.sha256" >> $GITHUB_ENV
100
-
101
- - name : Upload artifact
102
- uses : actions/upload-artifact@v3
58
+ - name : Upload artifacts
59
+ uses : actions/upload-artifact@v4
103
60
with :
104
61
name : ${{ env.ASSET }}
105
62
path : |
106
63
${{ env.ASSET }}
107
- ${{ env.ASSET_SUM }}
108
-
64
+
109
65
release :
110
66
runs-on : ubuntu-latest
111
- needs : ['build']
67
+ needs : ['archive']
68
+ # continue even though we failed to download or upload one
69
+ # or more artefacts
70
+ continue-on-error : true
112
71
steps :
113
72
- name : Create Release
114
73
id : create_release
@@ -120,77 +79,17 @@ jobs:
120
79
tag_name : ${{ github.ref_name }}
121
80
release_name : ${{ github.ref_name }}
122
81
123
- - name : Download linux-stable
124
- uses : actions/download-artifact@v3
125
- with :
126
- name : cggtts-cli-${{ github.ref_name }}-x86_64-unknown-linux-gnu.tar.gz
127
-
128
- - name : Upload linux-stable
129
- uses : actions/upload-release-asset@v1
130
- env :
131
- GITHUB_TOKEN : ${{ github.token }}
132
- with :
133
- upload_url : ${{ steps.create_release.outputs.upload_url }}
134
- asset_path : cggtts-cli-${{ github.ref_name }}-x86_64-unknown-linux-gnu.tar.gz
135
- asset_name : cggtts-cli-x86_x64-linux-gnu.tar.gz
136
- asset_content_type : application/gzip
137
-
138
- - name : Download macos-latest
139
- uses : actions/download-artifact@v3
82
+ - name : Download Artifact
83
+ uses : actions/download-artifact@v4
140
84
with :
141
- name : cggtts-cli-${{ github.ref_name }}-x86_64-apple-darwin.tar.gz
142
-
143
- - name : Upload macos-latest
144
- uses : actions/upload-release-asset@v1
145
- env :
146
- GITHUB_TOKEN : ${{ github.token }}
147
- with :
148
- upload_url : ${{ steps.create_release.outputs.upload_url }}
149
- asset_path : cggtts-cli-${{ github.ref_name }}-x86_64-apple-darwin.tar.gz
150
- asset_name : cggtts-cli-x86_64-apple-darwin.tar.gz
151
- asset_content_type : application/gzip
85
+ name : cggtts-${{ github.ref_name }}
152
86
153
- - name : Download macos-latest (aarch64)
154
- uses : actions/download-artifact@v3
155
- with :
156
- name : cggtts-cli-${{ github.ref_name }}-aarch64-apple-darwin.tar.gz
157
-
158
- - name : Upload macos-latest
87
+ - name : Upload asset
159
88
uses : actions/upload-release-asset@v1
160
89
env :
161
90
GITHUB_TOKEN : ${{ github.token }}
162
91
with :
163
92
upload_url : ${{ steps.create_release.outputs.upload_url }}
164
- asset_path : cggtts-cli- ${{ github.ref_name }}-aarch64-apple-darwin.tar.gz
165
- asset_name : cggtts-cli-aarch64-apple-darwin.tar.gz
93
+ asset_path : cggtts-${{ github.ref_name }}
94
+ asset_name : cggtts-${{ github.ref_name }}
166
95
asset_content_type : application/gzip
167
-
168
- - name : Download windows x86_64 (msvc)
169
- uses : actions/download-artifact@v3
170
- with :
171
- name : cggtts-cli-${{ github.ref_name }}-x86_64-pc-windows-msvc.zip
172
-
173
- - name : Download windows x86_64 (msvc)
174
- uses : actions/upload-release-asset@v1
175
- env :
176
- GITHUB_TOKEN : ${{ github.token }}
177
- with :
178
- upload_url : ${{ steps.create_release.outputs.upload_url }}
179
- asset_path : cggtts-cli-${{ github.ref_name }}-x86_64-pc-windows-msvc.zip
180
- asset_name : cggtts-cli-x86_64-pc-windows-msvc.zip
181
- asset_content_type : application/zip
182
-
183
- - name : Download windows x86_64 (gnu)
184
- uses : actions/download-artifact@v3
185
- with :
186
- name : cggtts-cli-${{ github.ref_name }}-x86_64-pc-windows-gnu.zip
187
-
188
- - name : Download windows x86_64 (msvc)
189
- uses : actions/upload-release-asset@v1
190
- env :
191
- GITHUB_TOKEN : ${{ github.token }}
192
- with :
193
- upload_url : ${{ steps.create_release.outputs.upload_url }}
194
- asset_path : cggtts-cli-${{ github.ref_name }}-x86_64-pc-windows-gnu.zip
195
- asset_name : cggtts-cli-x86_64-pc-windows-gnu.zip
196
- asset_content_type : application/zip
0 commit comments