-
Notifications
You must be signed in to change notification settings - Fork 4
67 lines (65 loc) · 2.2 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
name: Release
on:
push:
tags:
- sprocket-v*
jobs:
release:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Update Rust
run: rustup update stable && rustup default stable
- name: Update lock file
run: cargo update
- name: Publish to crates.io
run: cargo publish
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
- name: Create a GH release
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
make_latest: true
build_artifacts:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- rust-target: x86_64-unknown-linux-gnu
os: ubuntu-latest
extension: tar.gz
- rust-target: aarch64-unknown-linux-gnu
os: ubuntu-latest
cross: true
extension: tar.gz
- rust-target: x86_64-apple-darwin
os: macos-latest
extension: tar.gz
- rust-target: aarch64-apple-darwin
os: macos-latest
extension: tar.gz
- rust-target: x86_64-pc-windows-gnu
os: windows-latest
extension: zip
steps:
- uses: actions/checkout@v4
- name: Update Rust
run: rustup update stable && rustup default stable && rustup target add ${{ matrix.rust-target }}
- run: cargo build --release --target ${{ matrix.rust-target }}
if: ${{ ! matrix.cross }}
- run: cargo install cross
if: ${{ matrix.cross }}
- run: cross build --release --target ${{ matrix.rust-target }}
if: ${{ matrix.cross }}
- run: tar -czvf sprocket-${{ matrix.rust-target }}.tar.gz sprocket
working-directory: ./target/${{ matrix.rust-target }}/release
if: matrix.os != 'windows-latest'
- run: 7z a sprocket-${{ matrix.rust-target }}.zip sprocket.exe
working-directory: ./target/${{ matrix.rust-target }}/release
if: matrix.os == 'windows-latest'
- name: Update the GH release with the new artifact
uses: softprops/action-gh-release@v2
with:
files: ./target/${{ matrix.rust-target }}/release/sprocket-${{ matrix.rust-target }}.${{ matrix.extension }}