@@ -22,31 +22,51 @@ jobs:
2222 with :
2323 command : check
2424
25+ precheck :
26+ if : startsWith(github.ref, 'refs/tags/')
27+ runs-on : ubuntu-latest
28+ outputs :
29+ VERSION : ${{ steps.vars.outputs.VERSION }}
30+ steps :
31+ - name : Checkout
32+ uses : actions/checkout@v1
33+
34+ - name : Version
35+ id : vars
36+ shell : bash
37+ run : |
38+ version=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -n1)
39+ echo ::set-output name=VERSION::$(echo "$version")
40+
2541 publish :
42+ needs : [ precheck ]
2643 if : startsWith(github.ref, 'refs/tags/')
27- name : Publish for ${{ matrix.os }}
44+ name : Build ${{ matrix.target }}
2845 runs-on : ${{ matrix.os }}
2946 strategy :
47+ fail-fast : true
3048 matrix :
31- name : [
32- linux,
33- windows,
34- macos
35- ]
36-
3749 include :
38- - name : linux
50+ - target : x86_64-unknown- linux-gnu
3951 os : ubuntu-latest
40- artifact_name : target/release/reddsaver
41- asset_name : reddsaver- linux-amd64
42- - name : windows
43- os : windows -latest
44- artifact_name : target/release/reddsaver.exe
45- asset_name : reddsaver-windows-amd64
46- - name : macos
52+ use-cross : false
53+ jreleaser_platform : linux-x86_64
54+ - target : aarch64-unknown-linux-gnu
55+ os : ubuntu -latest
56+ use-cross : true
57+ jreleaser_platform : linux-aarch_64
58+ - target : x86_64-apple-darwin
4759 os : macos-latest
48- artifact_name : target/release/reddsaver
49- asset_name : reddsaver-macos-amd64
60+ use-cross : false
61+ jreleaser_platform : osx-x86_64
62+ - target : aarch64-apple-darwin
63+ os : macos-latest
64+ use-cross : false
65+ jreleaser_platform : osx-aarch_64
66+ - target : x86_64-pc-windows-msvc
67+ os : windows-latest
68+ use-cross : false
69+ jreleaser_platform : windows-x86_64
5070
5171 steps :
5272 - name : Checkout repository
@@ -57,15 +77,68 @@ jobs:
5777 with :
5878 profile : minimal
5979 toolchain : stable
80+ target : ${{ matrix.target }}
81+ override : true
6082
6183 - name : Build
62- run : cargo build --release --locked
84+ uses : actions-rs/cargo@v1
85+ with :
86+ use-cross : ${{ matrix.use-cross }}
87+ command : build
88+ args : --locked --release --target=${{ matrix.target }}
89+
90+ - name : Assemble
91+ uses : jreleaser/release-action@v2
92+ with :
93+ version : early-access
94+ arguments : assemble
95+ env :
96+ JRELEASER_PROJECT_VERSION : ${{ needs.precheck.outputs.VERSION }}
97+ JRELEASER_GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
98+ JRELEASER_PLATFORM_OVERRIDE : ${{ matrix.jreleaser_platform }}
99+
100+ - name : Upload artifacts
101+ uses : actions/upload-artifact@v3
102+ with :
103+ retention-days : 1
104+ name : artifacts
105+ path : |
106+ out/jreleaser/assemble/reddsaver/archive/*.zip
107+
108+ - name : JReleaser output
109+ if : always()
110+ uses : actions/upload-artifact@v3
111+ with :
112+ name : jreleaser-output-${{ matrix.target }}
113+ path : |
114+ out/jreleaser/trace.log
115+ out/jreleaser/output.properties
116+
117+ release :
118+ needs : [ precheck, publish ]
119+ runs-on : ubuntu-latest
120+
121+ steps :
122+ - name : Checkout
123+ uses : actions/checkout@v1
124+
125+ - name : Download artifacts
126+ uses : actions/download-artifact@v3
127+
128+ - name : Release
129+ uses : jreleaser/release-action@v2
130+ with :
131+ version : early-access
132+ arguments : full-release -PartifactsDir=artifacts -PskipArchiveResolver
133+ env :
134+ JRELEASER_PROJECT_VERSION : ${{ needs.precheck.outputs.VERSION }}
135+ JRELEASER_GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
63136
64- - name : Upload binaries to release
65- uses : svenstaro/upload-release-action@v2
137+ - name : JReleaser output
138+ if : always()
139+ uses : actions/upload-artifact@v3
66140 with :
67- repo_token : ${{ secrets.GITHUB_TOKEN }}
68- file : ${{ matrix.artifact_name }}
69- asset_name : ${{ matrix.asset_name }}
70- tag : ${{ github.ref }}
71- overwrite : true
141+ name : output-release-logs
142+ path : |
143+ out/jreleaser/trace.log
144+ out/jreleaser/output.properties
0 commit comments