-
Notifications
You must be signed in to change notification settings - Fork 0
62 lines (50 loc) · 1.74 KB
/
publish.yaml
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
name: publish
on:
release:
types: [published, released, prerelease]
jobs:
publish-binary:
name: publish-binary-${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
- os: windows-latest
target: x86_64-pc-windows-msvc
binary-suffix: .exe
- os: macos-latest
target: x86_64-apple-darwin
steps:
- uses: actions/checkout@v2
- name: set version
id: version
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/}
- name: install rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
target: ${{ matrix.target }}
- name: build
run: cargo build --release --locked
- name: strip binary
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
run: strip target/release/cargo-semver
- name: create release artifact
uses: actions/upload-artifact@v2
with:
name: cargo-semver-${{ matrix.target }}${{ matrix.binary-suffix }}
path: target/release/cargo-semver${{ matrix.binary-suffix }}
retention-days: 5
- name: upload binaries to release
uses: svenstaro/upload-release-action@v1-release
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: target/release/cargo-semver${{ matrix.binary-suffix }}
asset_name: cargo-semver-${{ steps.version.outputs.VERSION }}-${{ matrix.target }}${{ matrix.binary-suffix }}
tag: ${{ github.ref }}