-
Notifications
You must be signed in to change notification settings - Fork 0
128 lines (106 loc) · 3.5 KB
/
Copy pathrelease.yml
File metadata and controls
128 lines (106 loc) · 3.5 KB
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
name: Release
permissions:
contents: write
env:
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
CARGO_TERM_COLOR: always
RUST_BACKTRACE: full
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
build:
name: Build ${{ matrix.target.name }} package
runs-on: ${{ matrix.target.os }}
strategy:
matrix:
target:
[
{ name: aarch64-apple-darwin, os: macos-latest, binary: airseed },
{ name: x86_64-unknown-linux-musl, os: ubuntu-latest, binary: airseed },
{ name: x86_64-pc-windows-msvc, os: windows-latest, binary: airseed.exe },
]
steps:
- name: Fetch latest code
uses: actions/checkout@v6
- name: Set up Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
cache: true
components: rustfmt, clippy
- name: Add target
run: rustup target add ${{ matrix.target.name }}
- name: Install musl toolchain
if: matrix.target.name == 'x86_64-unknown-linux-musl'
run: sudo apt-get update && sudo apt-get install --yes musl-tools
- name: Build
run: cargo build --profile final-release --locked --target ${{ matrix.target.name }}
- name: Pack (macOS)
if: matrix.target.os == 'macos-latest'
run: |
mv target/${{ matrix.target.name }}/final-release/${{ matrix.target.binary }} airseed-${{ matrix.target.name }}
- name: Pack (Windows)
if: matrix.target.os == 'windows-latest'
run: |
mv target/${{ matrix.target.name }}/final-release/${{ matrix.target.binary }} airseed-${{ matrix.target.name }}.exe
- name: Pack (Linux)
if: matrix.target.os == 'ubuntu-latest'
run: |
mv target/${{ matrix.target.name }}/final-release/${{ matrix.target.binary }} airseed-${{ matrix.target.name }}
- name: Upload artifact
uses: actions/upload-artifact@v7
with:
name: airseed-${{ matrix.target.name }}
path: airseed-${{ matrix.target.name }}*
retention-days: 1
# release:
# name: Release
# runs-on: ubuntu-latest
# steps:
# - name: Publish
# uses: softprops/action-gh-release@v2
# with:
# discussion_category_name: Announcements
# generate_release_notes: true
release:
name: Release
runs-on: ubuntu-latest
needs: [build]
if: github.ref_type == 'tag'
steps:
- name: Download artifacts
uses: actions/download-artifact@v8
- name: Hash
run: |
mkdir -p artifacts
mv airseed-*/* artifacts/
cd artifacts
sha256sum * | tee ../SHA256
md5sum * | tee ../MD5
mv ../SHA256 .
mv ../MD5 .
- name: Publish
uses: softprops/action-gh-release@v2
with:
discussion_category_name: Announcements
generate_release_notes: true
files: artifacts/*
publish-on-crates-io:
name: Publish on crates.io
runs-on: ubuntu-latest
steps:
- name: Fetch latest code
uses: actions/checkout@v6
- name: Set up Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
cache: true
components: rustfmt, clippy
- name: Login
run: cargo login ${{ secrets.CARGO_REGISTRY_TOKEN }}
- name: Publish
run: cargo publish --locked