-
Notifications
You must be signed in to change notification settings - Fork 2
88 lines (85 loc) · 3.26 KB
/
cd.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
87
88
name: CD
on:
push:
tags:
- "v*.*.*"
env:
CARGO_TERM_COLOR: always
jobs:
publish:
name: Publishing ${{ matrix.build_target }}
runs-on: ${{ matrix.os }}
container: ${{ matrix.container }}
strategy:
matrix:
build_target: [linux-x86_64, linux-arm64, linux-armhf, macos-x86_64, windows-x86_64]
include:
- build_target: linux-x86_64
os: ubuntu-latest
container: rust
target: x86_64-unknown-linux-gnu
features: ''
dependencies: ''
- build_target: linux-arm64
os: ubuntu-latest
container: rustembedded/cross:aarch64-unknown-linux-gnu-0.2.1
target: aarch64-unknown-linux-gnu
features: ''
dependencies: ''
cross_arch: 'arm64'
pkg_config_path: '/usr/lib/aarch64-linux-gnu/pkgconfig/'
- build_target: linux-armhf
os: ubuntu-latest
container: rustembedded/cross:armv7-unknown-linux-gnueabihf-0.2.1
target: armv7-unknown-linux-gnueabihf
features: ''
dependencies: ''
cross_arch: 'armhf'
pkg_config_path: '/usr/lib/arm-linux-gnueabihf/pkgconfig/'
- build_target: macos-x86_64
os: macos-latest
target: x86_64-apple-darwin
features: ''
- build_target: windows-x86_64
os: windows-latest
target: x86_64-pc-windows-msvc
features: ''
steps:
- name: Install Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
target: ${{ matrix.target }}
- name: Set up cross compilation
if: matrix.cross_arch
run: |
dpkg --add-architecture ${{ matrix.cross_arch }}
echo "PKG_CONFIG_PATH=${{ matrix.pkg_config_path }}" >> $GITHUB_ENV
echo "PKG_CONFIG_ALLOW_CROSS=1" >> $GITHUB_ENV
- uses: actions/checkout@v4
name: Checkout src
- name: Running cargo build
run: cargo build --locked --release --target ${{ matrix.target }} ${{ matrix.features }}
- name: Extract git tag
shell: bash
run: echo "##[set-output name=tag;]$(echo ${GITHUB_REF#refs/tags/})"
id: extract_tag
- name: Packaging assets
shell: bash
run: |
cd target/${{ matrix.target }}/release
case ${{ matrix.target }} in
*-pc-windows-*)
7z -y a sinuous-${{ steps.extract_tag.outputs.tag }}-${{ matrix.build_target }}.zip sinuous.exe
sha256sum sinuous-${{ steps.extract_tag.outputs.tag }}-${{ matrix.build_target }}.zip > sinuous-${{ steps.extract_tag.outputs.tag }}-${{ matrix.build_target }}.sha256
;;
*)
tar czvf sinuous-${{ steps.extract_tag.outputs.tag }}-${{ matrix.build_target }}.tar.gz sinuous
shasum -a 256 sinuous-${{ steps.extract_tag.outputs.tag }}-${{ matrix.build_target }}.tar.gz > sinuous-${{ steps.extract_tag.outputs.tag }}-${{ matrix.build_target }}.sha256
;;
esac;
- name: Releasing assets
uses: softprops/action-gh-release@v1
with:
files: target/${{ matrix.target }}/release/sinuous-*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}