-
-
Notifications
You must be signed in to change notification settings - Fork 26
236 lines (220 loc) · 8.05 KB
/
warp-input.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
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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
#Tabs not spaces, you moron :)
name: CI for netris:warp-input
on:
pull_request:
paths:
- "warp-input.Dockerfile"
- ".github/workflows/warp-input.yml"
- "bin/input/**"
schedule:
- cron: 0 0 * * * # At the end of everyday
workflow_dispatch:
push:
branches: [main]
paths:
- "warp-input.Dockerfile"
- ".github/workflows/warp-input.yml"
- "bin/input/**"
tags:
- v*.*.*
release:
types: [published, created]
env:
REGISTRY: ghcr.io
IMAGE_NAME: nestriness/nestri
BASE_TAG_PREFIX: warp-input
# concurrency:
# group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/main' && github.run_id || github.event.pull_request.number || github.ref }}
# cancel-in-progress: true
jobs:
build-docker-pr:
name: Build image on pr
runs-on: ubuntu-latest
if: ${{ github.event_name == 'pull_request' }}
steps:
-
name: Checkout repo
uses: actions/checkout@v4
with:
submodules: recursive
-
name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Build Docker image
uses: docker/build-push-action@v6
with:
file: warp-input.Dockerfile
context: ./
push: false
load: true
tags: netris:warp-input
build-docker-main:
name: Build image on merge to main
if: ${{github.ref == 'refs/heads/main'}}
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
-
name: Checkout repo
uses: actions/checkout@v4
with:
submodules: recursive
-
name: Log into registry ${{ env.REGISTRY }}
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GIT_MASTER_TOKEN }}
-
name: Extract Container metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/${{ env.BASE_TAG_PREFIX }}
#
#tag on release, and a nightly build for 'dev'
tags: |
type=raw,value=nightly,enable={{is_default_branch}}
type=ref,event=tag
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
-
name: Build Docker image
uses: docker/build-push-action@v6
with:
file: warp-input.Dockerfile
context: ./
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-docker-release:
name: Build image on release
if: ${{ github.event_name == 'release' }}
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
-
name: Checkout repo
uses: actions/checkout@v4
with:
submodules: recursive
-
name: Log into registry ${{ env.REGISTRY }}
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GIT_MASTER_TOKEN }}
-
name: Extract Container metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/${{ env.BASE_TAG_PREFIX }}
#
#tag on release, and a nightly build for 'dev'
tags: |
type=raw,value=nightly,enable={{is_default_branch}}
type=ref,event=tag
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
-
name: Build Docker image
uses: docker/build-push-action@v6
with:
file: warp-input.Dockerfile
context: ./
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-warp-input-release:
if: ${{ github.event_name == 'release' }}
defaults:
run:
working-directory: bin/input
strategy:
fail-fast: false
matrix:
settings:
- host: ubuntu-20.04
target: x86_64-unknown-linux-gnu
bundles: appimage
asset_name: warp-input-ubuntu-amd64
- host: windows-latest
target: x86_64-pc-windows-msvc
bundles: msi
asset_name: warp-input-windows-amd64
# - host: macos-latest
# target: x86_64-apple-darwin
# bundles: dmg
# asset_name: warp-input-macos-amd64
# - host: macos-latest
# target: aarch64-apple-darwin
# bundles: dmg
# asset_name: warp-input-macos-apple-silicon
# - host: ubuntu-20.04
# target: x86_64-unknown-linux-musl
# - host: ubuntu-20.04
# target: aarch64-unknown-linux-gnu
# - host: ubuntu-20.04
# target: aarch64-unknown-linux-musl
# - host: ubuntu-20.04
# target: armv7-unknown-linux-gnueabihf
name: Build warp-input on release
runs-on: ${{ matrix.settings.host }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Rust
id: toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.settings.target }}
toolchain: stable
components: clippy, rustfmt
- name: Cache Rust Dependencies
uses: Swatinem/rust-cache@v2
with:
save-if: false
prefix-key: 'v0-rust-deps'
shared-key: ${{ matrix.settings.target }}
- name: Cargo build
run: cargo build --target ${{ matrix.settings.target }} --release
- name: Copy and rename artifacts (Linux)
if: ${{ matrix.settings.host == 'ubuntu-20.04' }}
run: |
cp target/${{ matrix.settings.target }}/release/warp-input ./warp-input
- name: Copy and rename artifacts (Windows)
if: ${{ matrix.settings.host == 'windows-latest' }}
run: |
cp "target/${{ matrix.settings.target }}/release/warp-input.exe" ./warp-input.exe
- name: Copy and rename artifacts (macOS)
if: ${{ matrix.settings.host == 'macos-latest' }}
run: |
cp target/${{ matrix.settings.target }}/release/warp-input ./warp-input
- name: Publish release for (${{ matrix.settings.host }})
if: ${{ matrix.settings.host == 'windows-latest' }}
uses: svenstaro/[email protected]
with:
repo_token: ${{ secrets.GIT_MASTER_TOKEN }}
file: ./bin/input/warp-input.exe
asset_name: ${{ matrix.settings.asset_name }}
tag: ${{ github.ref }}
- name: Publish release for (${{ matrix.settings.host }})
if: ${{ matrix.settings.host != 'windows-latest' }}
uses: svenstaro/[email protected]
with:
repo_token: ${{ secrets.GIT_MASTER_TOKEN }}
file: ./bin/input/warp-input
asset_name: ${{ matrix.settings.asset_name }}
tag: ${{ github.ref }}