1+ name : GitHub Release
2+
3+ on :
4+ push :
5+ tags :
6+ - v[0-9]+.[0-9]+.[0-9]+*
7+
8+ jobs :
9+ release :
10+ name : Publish to Github Releases
11+ outputs :
12+ rc : ${{ steps.check-tag.outputs.rc }}
13+ strategy :
14+ matrix :
15+ include :
16+ - target : aarch64-unknown-linux-musl
17+ os : ubuntu-latest
18+ use-cross : true
19+ cargo-flags : " "
20+ - target : aarch64-apple-darwin
21+ os : macos-latest
22+ use-cross : true
23+ cargo-flags : " "
24+ - target : aarch64-pc-windows-msvc
25+ os : windows-latest
26+ use-cross : true
27+ cargo-flags : " --no-default-features"
28+ - target : x86_64-apple-darwin
29+ os : macos-latest
30+ cargo-flags : " "
31+ - target : x86_64-pc-windows-msvc
32+ os : windows-latest
33+ cargo-flags : " "
34+ - target : x86_64-unknown-linux-musl
35+ os : ubuntu-latest
36+ use-cross : true
37+ cargo-flags : " "
38+ - target : i686-unknown-linux-musl
39+ os : ubuntu-latest
40+ use-cross : true
41+ cargo-flags : " "
42+ - target : i686-pc-windows-msvc
43+ os : windows-latest
44+ use-cross : true
45+ cargo-flags : " "
46+ - target : armv7-unknown-linux-musleabihf
47+ os : ubuntu-latest
48+ use-cross : true
49+ cargo-flags : " "
50+ - target : arm-unknown-linux-musleabihf
51+ os : ubuntu-latest
52+ use-cross : true
53+ cargo-flags : " "
54+ - target : mips-unknown-linux-musl
55+ os : ubuntu-latest
56+ use-cross : true
57+ cargo-flags : " --no-default-features"
58+ - target : mipsel-unknown-linux-musl
59+ os : ubuntu-latest
60+ use-cross : true
61+ cargo-flags : " --no-default-features"
62+ - target : mips64-unknown-linux-gnuabi64
63+ os : ubuntu-latest
64+ use-cross : true
65+ cargo-flags : " --no-default-features"
66+ - target : mips64el-unknown-linux-gnuabi64
67+ os : ubuntu-latest
68+ use-cross : true
69+ cargo-flags : " --no-default-features"
70+ runs-on : ${{matrix.os}}
71+
72+ steps :
73+ - uses : actions/checkout@v2
74+
75+ - name : Check Tag
76+ id : check-tag
77+ shell : bash
78+ run : |
79+ tag=${GITHUB_REF##*/}
80+ echo "::set-output name=version::$tag"
81+ if [[ "$tag" =~ [0-9]+.[0-9]+.[0-9]+$ ]]; then
82+ echo "::set-output name=rc::false"
83+ else
84+ echo "::set-output name=rc::true"
85+ fi
86+
87+
88+ - name : Install Rust Toolchain Components
89+ uses : actions-rs/toolchain@v1
90+ with :
91+ override : true
92+ target : ${{ matrix.target }}
93+ toolchain : stable
94+ profile : minimal # minimal component installation (ie, no documentation)
95+
96+ - name : Show Version Information (Rust, cargo, GCC)
97+ shell : bash
98+ run : |
99+ gcc --version || true
100+ rustup -V
101+ rustup toolchain list
102+ rustup default
103+ cargo -V
104+ rustc -V
105+
106+ - name : Build
107+ uses : actions-rs/cargo@v1
108+ with :
109+ use-cross : ${{ matrix.use-cross }}
110+ command : build
111+ args : --locked --release --target=${{ matrix.target }} ${{ matrix.cargo-flags }}
112+
113+ - name : Build Archive
114+ shell : bash
115+ id : package
116+ env :
117+ target : ${{ matrix.target }}
118+ version : ${{ steps.check-tag.outputs.version }}
119+ run : |
120+ set -euxo pipefail
121+
122+ bin=${GITHUB_REPOSITORY##*/}
123+ src=`pwd`
124+ dist=$src/dist
125+ name=$bin-$version-$target
126+ executable=target/$target/release/$bin
127+
128+ if [[ "$RUNNER_OS" == "Windows" ]]; then
129+ executable=$executable.exe
130+ fi
131+
132+ mkdir $dist
133+ cp $executable $dist
134+ cd $dist
135+
136+ if [[ "$RUNNER_OS" == "Windows" ]]; then
137+ archive=$dist/$name.zip
138+ 7z a $archive *
139+ echo "::set-output name=archive::`pwd -W`/$name.zip"
140+ else
141+ archive=$dist/$name.tar.gz
142+ tar czf $archive *
143+ echo "::set-output name=archive::$archive"
144+ fi
145+
146+ - name : Publish Archive
147+ 148+ if : ${{ startsWith(github.ref, 'refs/tags/') }}
149+ with :
150+ draft : false
151+ files : ${{ steps.package.outputs.archive }}
152+ prerelease : ${{ steps.check-tag.outputs.rc == 'true' }}
153+ env :
154+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments