-
Notifications
You must be signed in to change notification settings - Fork 2
114 lines (104 loc) · 3.62 KB
/
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
102
103
104
105
106
107
108
109
110
111
112
113
114
on:
push:
# Listen for semver-tagged pushes to generate releases
tags:
- v[0-9]+.[0-9]+.[0-9]+
# Workflow for creating a new release and attaching clean-built artifacts
name: release
env:
toolchain: stable
# ? Note: doesn't currently use a matrix due to each target OS having very
# ? different dependency installation requirements
jobs:
# Build for 64-bit linux and add binary as an artifact to release
linux-amd64:
name: Publish (linux-amd64)
runs-on: ubuntu-latest
env:
artifact-name: radvisor-linux-amd64
build-target: x86_64-unknown-linux-gnu
output-dir: out
output-path: out/radvisor
steps:
- uses: actions/checkout@v2
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ env.toolchain }}
override: true
# Build binaries (cleanbuild for release)
- name: Make output directory
run: mkdir -p ${{ env.output-dir }}
- name: Run cargo build
run: make all BUILD_TARGET=${{ env.build-target }} OUT_DIR=${{ env.output-dir }}
- name: Strip binary
run: strip ${{ env.output-path }}
# Make sure artifacts were created and run properly
- run: stat ${{ env.output-path }}
- run: ${{ env.output-path }} --help
- run: stat ${{ env.output-path }}-toolbox
- run: ${{ env.output-path }}-toolbox --help
# Upload artifacts and create new release if needed
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v1-release
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ env.output-path }}
asset_name: ${{ env.artifact-name }}
tag: ${{ github.ref }}
overwrite: true
# Create package files
- name: Run toolbox generation
run: >-
${{ env.output-path }}-toolbox
-v --color=never
--repo-root .
# Compile manpages
- name: Install pandoc
run: sudo apt-get install -y pandoc
- name: Compiling manpages
shell: bash
run: >-
(
mkdir -p "out/man"
cd man
for i in $(find . -name 'radvisor*.1.md')
do
base="${i%.*}"
echo "Generating man pages for $i at $base"
pandoc --standalone --to man "$i" -o "$base"
echo "Compressing manpages to $base.gz"
gzip -f "$base"
mv "$base.gz" "../out/man/"
done
)
# Create .deb
- name: Install cargo-deb
uses: actions-rs/cargo@v1
with:
command: install
args: cargo-deb
- name: Generate deb package with cargo-deb
uses: actions-rs/cargo@v1
with:
command: deb
args: >-
--target=${{ env.build-target }}
--no-build
- name: Locate deb package
id: deb-location
run: echo "::set-output name=path::$(find ./ -type f -name "*.deb" | head -1)"
# Make sure package was created and is valid
- run: stat ${{ steps.deb-location.outputs.path }}
- run: dpkg -c ${{ steps.deb-location.outputs.path }}
- run: dpkg -I ${{ steps.deb-location.outputs.path }}
# Upload package artifacts and create new release if needed
- name: Upload package to release
uses: svenstaro/upload-release-action@v1-release
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ steps.deb-location.outputs.path }}
asset_name: ${{ env.artifact-name }}.deb
tag: ${{ github.ref }}
overwrite: true