-
Notifications
You must be signed in to change notification settings - Fork 7
179 lines (142 loc) · 4.83 KB
/
release.yaml
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
name: Release
on:
push:
tags:
- '*'
env:
binary: ncube
jobs:
# Publish on crates.io
publish-to-crates:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Cache toolchain
uses: Swatinem/rust-cache@v2
- name: Install dependencies
run: |
sudo apt-get update; sudo apt-get install pkg-config libx11-dev libasound2-dev libudev-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev
- name: Publish to crates.io
run: cargo publish --token ${CRATES_TOKEN}
env:
CRATES_TOKEN: ${{ secrets.CRATES_TOKEN }}
# Linux
release-linux:
runs-on: ubuntu-latest
steps:
- uses: olegtarasov/get-tag@v2.1.2
id: get_version
- name: Checkout sources
uses: actions/checkout@v3
- name: Install toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-unknown-linux-gnu
- name: Cache toolchain
uses: Swatinem/rust-cache@v2
- name: Install dependencies
run: |
sudo apt-get update; sudo apt-get install pkg-config libx11-dev libasound2-dev libudev-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev
- name: Build
run: |
cargo build --release --target x86_64-unknown-linux-gnu
- name: Prepare package
run: |
mkdir linux
cp target/x86_64-unknown-linux-gnu/release/${{ env.binary }} linux/
- name: Package as a zip
working-directory: ./linux
run: |
zip --recurse-paths ../${{ env.binary }}.zip .
- name: Upload binaries to artifacts
uses: actions/upload-artifact@v3
with:
path: ${{ env.binary }}.zip
name: linux
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ env.binary }}.zip
asset_name: ${{ env.binary }}-linux-${{ steps.get_version.outputs.tag }}.zip
tag: ${{ github.ref }}
overwrite: true
# Publish for Windows
release-windows:
runs-on: windows-latest
steps:
- uses: olegtarasov/get-tag@v2.1.2
id: get_version
- name: Checkout sources
uses: actions/checkout@v3
- name: Install toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-pc-windows-msvc
- name: Build
run: |
cargo build --release --target x86_64-pc-windows-msvc
- name: Prepare package
run: |
mkdir windows
cp target/x86_64-pc-windows-msvc/release/${{ env.binary }}.exe windows/
- name: Package as a zip
run: |
Compress-Archive -Path windows/* -DestinationPath ${{ env.binary }}.zip
- name: Upload binaries to artifacts
uses: actions/upload-artifact@v3
with:
path: ${{ env.binary }}.zip
name: windows
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ env.binary }}.zip
asset_name: ${{ env.binary }}-windows-${{ steps.get_version.outputs.tag }}.zip
tag: ${{ github.ref }}
overwrite: true
# Publish for macOS
release-macos:
runs-on: macOS-latest
steps:
- uses: olegtarasov/get-tag@v2.1.2
id: get_version
- name: Checkout sources
uses: actions/checkout@v3
- name: Install toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-apple-darwin
- name: Setup environment
run: |
export CFLAGS="-fno-stack-check"
export MACOSX_DEPLOYMENT_TARGET="10.9"
- name: Build
run: |
cargo build --release --target x86_64-apple-darwin
- name: Prepare package
run: |
mkdir -p ${{ env.binary }}.app/Contents/MacOS
cp target/x86_64-apple-darwin/release/${{ env.binary }} ${{ env.binary }}.app/Contents/MacOS/
hdiutil create -fs HFS+ -volname "${{ env.binary }}" -srcfolder ${{ env.binary }}.app ${{ env.binary }}.dmg
- name: Upload binaries to artifacts
uses: actions/upload-artifact@v3
with:
path: ${{ env.binary }}.dmg
name: mac
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ env.binary }}.dmg
asset_name: ${{ env.binary }}-macos-${{ steps.get_version.outputs.tag }}.dmg
tag: ${{ github.ref }}
overwrite: true