-
Notifications
You must be signed in to change notification settings - Fork 8
84 lines (81 loc) · 3.3 KB
/
release.yml
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
name: Release
on:
release:
types:
- created
jobs:
build:
strategy:
matrix:
environment:
- os: "ubuntu-latest"
target: "x86_64-unknown-linux-gnu"
cross: true
exec: jwtinfo
artifact-name: "jwtinfo-unix64"
- os: "macos-latest"
target: "x86_64-apple-darwin"
cross: true
exec: jwtinfo
artifact-name: "jwtinfo-macos"
- os: "macos-latest"
target: "aarch64-apple-darwin"
cross: true
exec: jwtinfo
artifact-name: "jwtinfo-macos-silicon"
- os: "ubuntu-latest"
target: "x86_64-pc-windows-gnu"
cross: true
exec: jwtinfo.exe
artifact-name: "jwtinfo-win64.exe"
packages: "gcc-mingw-w64"
- os: "ubuntu-latest"
target: "armv7-unknown-linux-gnueabihf"
cross: true
exec: jwtinfo
artifact-name: "jwtinfo-armv7"
packages: "gcc-arm-linux-gnueabihf"
runs-on: "${{ matrix.environment.os }}"
name: "${{ matrix.environment.os }} (${{ matrix.environment.target }})"
steps:
- uses: actions/checkout@v4
- name: Run tests
run: cargo test --verbose
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.environment.target }}
override: true
- name: Install system packages
if: matrix.environment.packages
run: |
sudo apt-get update;
sudo apt-get install -qq ${{ matrix.environment.packages }};
- uses: actions-rs/cargo@v1
with:
use-cross: ${{ matrix.environment.cross }}
command: build
args: --release --target ${{ matrix.environment.target }} --verbose
- name: Make release executable
run: chmod +x target/${{ matrix.environment.target }}/release/${{ matrix.environment.exec }}
- name: Gzip artifact
run: gzip -f --keep target/${{ matrix.environment.target }}/release/${{ matrix.environment.exec }}
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: target/${{ matrix.environment.target }}/release/${{ matrix.environment.exec }}.gz
asset_name: ${{ matrix.environment.artifact-name }}.gz
asset_content_type: application/x-gzip
release:
needs:
- build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Release on Crates.io
run: |
cargo login ${{ secrets.CARGO_TOKEN }}
cargo publish