-
Notifications
You must be signed in to change notification settings - Fork 13
86 lines (75 loc) · 2.4 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
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: Publish
on:
push:
tags:
- "*"
jobs:
publish:
name: Publish for ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
artifact_name: crabz
asset_name: crabz-linux-amd64
- os: macos-latest
artifact_name: crabz
asset_name: crabz-macos-amd64
- os: windows-latest
artifact_name: crabz.exe
asset_name: crabz-windows-amd64.exe
steps:
- uses: actions/checkout@v2
- name: Build
shell: bash
run: |
cargo build --release --locked
- name: Build archive
shell: bash
run: |
staging="${{matrix.asset_name}}-src"
mkdir -p "$staging"
cp {README.md,UNLICENSE,LICENSE-MIT} "$staging/"
cp {Cargo.toml,Cargo.lock} "$staging/"
cp -R ./src "./$staging/src"
if [ "${{ matrix.os }}" = "windows-latest" ]; then
7z a "${staging}.zip" "$staging"
echo "ASSET=${staging}.zip" >> $GITHUB_ENV
else
tar czf "${staging}.tar.gz" "${staging}"
echo "ASSET=${staging}.tar.gz" >> $GITHUB_ENV
fi
- name: Create deb artifact
shell: bash
run: |
if [ "${{ matrix.os }}" = "ubuntu-latest" ]; then
cd ..
cargo install --locked cargo-deb
cd -
asset_path="${{ matrix.asset_name }}.deb"
cargo deb --output ./"${asset_path}"
echo "DEB=${asset_path}" >> $GITHUB_ENV
fi
- name: Upload deb package
uses: svenstaro/upload-release-action@v2
if: matrix.os == 'ubuntu-latest'
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ env.DEB }}
asset_name: ${{ env.DEB }}
tag: ${{ github.ref }}
- name: Upload src to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ env.ASSET }}
asset_name: ${{ env.ASSET }}
tag: ${{ github.ref }}
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: target/release/${{ matrix.artifact_name }}
asset_name: ${{ matrix.asset_name }}
tag: ${{ github.ref }}