-
Notifications
You must be signed in to change notification settings - Fork 27
101 lines (86 loc) · 2.92 KB
/
on-release.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
89
90
91
92
93
94
95
96
97
98
99
100
101
name: On Release
on:
workflow_dispatch:
push:
tags:
- "v*.*.*"
env:
CARGO_TERM_COLOR: always
jobs:
release:
runs-on: ${{ matrix.os }}
strategy:
matrix:
build: [linux, macos]
include:
- build: linux
os: ubuntu-22.04
rust: stable
target: x86_64-unknown-linux-musl
- build: macos
os: macos-12
rust: stable
target: x86_64-apple-darwin
steps:
- name: Install Ubuntu tools
if: matrix.os == 'ubuntu-22.04'
run: sudo apt-get update && sudo apt-get install -y musl-tools rpm
- name: Install Mac OS X tools
if: matrix.build == 'macos'
run: brew install coreutils
- name: Checkout sources
uses: actions/checkout@v2
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
target: ${{ matrix.target }}
override: true
- name: Build binary
uses: actions-rs/cargo@v1
with:
command: build
args: --release --target ${{ matrix.target }}
- name: Strip binary
run: strip ./target/${{ matrix.target }}/release/scriptisto
- name: Make bz2
run: |
tar -cjvf ./scriptisto-${{ matrix.target }}.tar.bz2 --directory=./target/${{ matrix.target }}/release scriptisto
sha256sum ./scriptisto-${{ matrix.target }}.tar.bz2
- name: Install tools from crates
if: matrix.build == 'linux'
uses: actions-rs/cargo@v1
with:
command: install
args: cargo-deb cargo-generate-rpm
- name: Copy to standard location
if: matrix.build == 'linux'
run: |
mkdir -p ./target/release
cp ./target/${{ matrix.target }}/release/scriptisto ./target/release/scriptisto
- name: Build RPM
if: matrix.build == 'linux'
run: |
cargo generate-rpm --target ${{ matrix.target }}
sha256sum ./target/${{ matrix.target }}/generate-rpm/*.rpm
- name: Build DEB
if: matrix.build == 'linux'
run: |
cargo deb --no-build --separate-debug-symbols --target ${{ matrix.target }}
sha256sum ./target/${{ matrix.target }}/debian/*.deb
- name: Release Linux
uses: softprops/action-gh-release@v1
if: matrix.build == 'linux' && startsWith(github.ref, 'refs/tags/')
with:
append_body: true
files: |
./scriptisto-${{ matrix.target }}.tar.bz2
./target/${{ matrix.target }}/debian/*.deb
./target/${{ matrix.target }}/generate-rpm/*.rpm
- name: Release Mac OS X
uses: softprops/action-gh-release@v1
if: matrix.build == 'macos' && startsWith(github.ref, 'refs/tags/')
with:
append_body: true
files: |
./scriptisto-${{ matrix.target }}.tar.bz2