-
Notifications
You must be signed in to change notification settings - Fork 24
56 lines (55 loc) · 1.64 KB
/
publish.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
name: Publish
on:
push:
tags:
- '*'
jobs:
build:
name: Publish binaries
runs-on: ubuntu-latest
strategy:
matrix:
target:
- x86_64-unknown-linux-musl
# TODO: fix other architectures support
#- i686-unknown-linux-musl
#- armv7-unknown-linux-musleabihf
#- aarch64-unknown-linux-musl
rust: [stable]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
target: ${{ matrix.target }}
override: true
- name: Build
run: cargo build --release --target ${{ matrix.target }} --locked
- name: Package
run: |
version=$(basename ${{ github.ref }})
name="cntr-$version"
depsname="cntr-src-$version"
install -D target/${{ matrix.target }}/release/cntr dist/cntr-bin-$version-${{ matrix.target }}
mkdir $depsname
git archive HEAD | tar -x -C $depsname
cargo vendor
mv vendor $depsname/
tar -czvf dist/$depsname.tar.gz $depsname
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: dist/*
tag: ${{ github.ref }}
overwrite: true
file_glob: true
# publish-crates does not like this
- name: Cleanup dist
run: rm -r dist
- uses: katyo/publish-crates@v2
with:
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}