-
Notifications
You must be signed in to change notification settings - Fork 0
86 lines (71 loc) · 2.18 KB
/
cd.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
name: CD
on:
push:
tags:
- v[0-9]+.[0-9]+.[0-9]+
jobs:
draft:
name: Draft
runs-on: ubuntu-latest
steps:
- name: Create draft release
run: gh release create ${{ github.ref_name }} --draft --generate-notes --repo ${{ github.repository }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
upload:
name: Upload
needs: draft
strategy:
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
command: cargo
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
command: cross
- target: x86_64-apple-darwin
os: macos-latest
command: cargo
- target: aarch64-apple-darwin
os: macos-latest
command: cargo
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup rust
uses: dtolnay/rust-toolchain@stable
with:
target: ${{ matrix.target }}
- name: Install cross
run: cargo install cross
if: matrix.command == 'cross'
- name: Run ${{ matrix.command }} build
run: ${{ matrix.command }} build --release --locked --target ${{ matrix.target }}
- name: Upload artifact
run: |
cd target/${{ matrix.target }}/release
tar czvf ../../../${{ matrix.target }}.gz ${{ github.event.repository.name }}
cd -
gh release upload ${{ github.ref_name }} ${{ matrix.target }}.gz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish:
name: Publish
needs: upload
runs-on: ubuntu-latest
environment: release
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Publish crate
run: cargo publish --token ${{ secrets.CARGO_TOKEN }}
- name: Publish release
run: gh release edit ${{ github.ref_name }} --draft=false --repo ${{ github.repository }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}