-
-
Notifications
You must be signed in to change notification settings - Fork 102
199 lines (196 loc) · 7.49 KB
/
build.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
name: Build
on: [push, pull_request]
jobs:
linux:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: docker/setup-qemu-action@v3
with:
platforms: arm64
- uses: docker/setup-buildx-action@v3
with:
platforms: linux/amd64,linux/arm64
- uses: docker/build-push-action@v5
id: docker_build_amd64
with:
context: .
platforms: amd64
cache-from: type=gha
cache-to: type=gha
load: true
- uses: docker/build-push-action@v5
id: docker_build_arm64
with:
context: .
platforms: arm64
cache-from: type=gha
cache-to: type=gha
load: true
- uses: docker/login-action@v3
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
if: github.event_name == 'push'
- uses: docker/metadata-action@v5
id: meta
with:
images: ${{ vars.DOCKERHUB_USERNAME }}/fishnet
tags: |
type=ref,event=branch
type=semver,pattern={{major}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{version}}
labels: |
org.opencontainers.image.licenses=GPL-3.0-or-later
if: github.event_name == 'push'
- uses: docker/build-push-action@v5
id: docker_push
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
if: github.event_name == 'push'
- run: docker cp "$(docker create ${{ steps.docker_build_amd64.outputs.imageid }}):/fishnet" fishnet-x86_64-unknown-linux-musl
- run: docker cp "$(docker create ${{ steps.docker_build_arm64.outputs.imageid }}):/fishnet" fishnet-aarch64-unknown-linux-musl
- uses: actions/upload-artifact@v4
with:
name: fishnet-x86_64-unknown-linux-musl
path: fishnet-x86_64-unknown-linux-musl
- uses: actions/upload-artifact@v4
with:
name: fishnet-aarch64-unknown-linux-musl
path: fishnet-aarch64-unknown-linux-musl
windows-x86-64:
runs-on: windows-2019
defaults:
run:
shell: msys2 {0}
steps:
- uses: msys2/setup-msys2@v2
with:
msystem: mingw64
update: true
install: mingw-w64-x86_64-gcc mingw-w64-x86_64-rust mingw-w64-x86_64-make tar
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions/checkout@v4
with:
repository: lichess-org/intel-sde
ssh-key: ${{ secrets.ID_RSA_INTEL_SDE }}
ref: main
path: intel-sde
id: sde
continue-on-error: true
- run: tar xf intel-sde/sde-external-9.0.0-2021-11-07-win.tar.xz && echo SDE_PATH=$(cygpath -u $GITHUB_WORKSPACE)/sde-external-9.0.0-2021-11-07-win/sde.exe | tee $GITHUB_ENV
if: steps.sde.outcome == 'success'
- run: cargo build --release --target x86_64-pc-windows-gnu -vv
- run: mv target/x86_64-pc-windows-gnu/release/fishnet.exe fishnet-x86_64-pc-windows-gnu-unsigned.exe
- uses: actions/upload-artifact@v4
id: upload-unsigned-artifact
with:
name: fishnet-x86_64-pc-windows-gnu-unsigned
path: fishnet-x86_64-pc-windows-gnu-unsigned.exe
- uses: signpath/github-action-submit-signing-request@v0.4
with:
api-token: ${{ secrets.SIGNPATH_API_TOKEN }}
organization-id: ${{ vars.SIGNPATH_ORGANIZATION_ID }}
project-slug: 'fishnet'
signing-policy-slug: ${{ startsWith(github.ref, 'refs/tags/v') && 'release-signing' || 'test-signing' }}
github-artifact-id: ${{ steps.upload-unsigned-artifact.outputs.artifact-id }}
wait-for-completion: true
output-artifact-directory: signed
- uses: actions/upload-artifact@v4
with:
name: fishnet-x86_64-pc-windows-gnu
path: signed
macos-x86-64:
runs-on: macos-13
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: dtolnay/rust-toolchain@stable
- run: cargo install --force cargo-auditable
- run: cargo auditable build --release -vv
- run: mv target/release/fishnet fishnet-x86_64-apple-darwin
- uses: actions/upload-artifact@v4
with:
name: fishnet-x86_64-apple-darwin
path: fishnet-x86_64-apple-darwin
macos-aarch64:
runs-on: macos-12
env:
CXXFLAGS: -target arm64-apple-macos11
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: dtolnay/rust-toolchain@stable
with:
targets: aarch64-apple-darwin
- run: cargo install --force cargo-auditable
- run: cargo auditable build --release --target aarch64-apple-darwin -vv
- run: mv target/aarch64-apple-darwin/release/fishnet fishnet-aarch64-apple-darwin
- uses: actions/upload-artifact@v4
with:
name: fishnet-aarch64-apple-darwin
path: fishnet-aarch64-apple-darwin
github_release:
runs-on: ubuntu-latest
permissions:
contents: write
needs:
- linux
- windows-x86-64
- macos-x86-64
- macos-aarch64
if: startsWith(github.ref, 'refs/tags/v')
steps:
- run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
id: get_version
- uses: actions/download-artifact@v4
with:
merge-multiple: true
- run: sha256sum fishnet-*
- uses: softprops/action-gh-release@v1
with:
name: fishnet ${{ steps.get_version.outputs.VERSION }}
body: |
Downloads:
* [fishnet-x86_64-unknown-linux-musl](https://fishnet-releases.s3.dualstack.eu-west-3.amazonaws.com/${{ steps.get_version.outputs.VERSION }}/fishnet-x86_64-unknown-linux-musl)
* [fishnet-x86_64-pc-windows-gnu.exe](https://fishnet-releases.s3.dualstack.eu-west-3.amazonaws.com/${{ steps.get_version.outputs.VERSION }}/fishnet-x86_64-pc-windows-gnu.exe)
* [fishnet-x86_64-apple-darwin](https://fishnet-releases.s3.dualstack.eu-west-3.amazonaws.com/${{ steps.get_version.outputs.VERSION }}/fishnet-x86_64-apple-darwin)
* [fishnet-aarch64-unknown-linux-musl](https://fishnet-releases.s3.dualstack.eu-west-3.amazonaws.com/${{ steps.get_version.outputs.VERSION }}/fishnet-aarch64-unknown-linux-musl)
* [fishnet-aarch64-apple-darwin](https://fishnet-releases.s3.dualstack.eu-west-3.amazonaws.com/${{ steps.get_version.outputs.VERSION }}/fishnet-aarch64-apple-darwin)
generate_release_notes: true
draft: true
files: fishnet-*
fail_on_unmatched_files: true
s3_release:
runs-on: ubuntu-latest
environment:
name: s3
needs: github_release
steps:
- run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
id: get_version
- uses: actions/download-artifact@v4
with:
merge-multiple: true
- run: sha256sum fishnet-*
- uses: shallwefootball/s3-upload-action@bcd7c2408245fd6cd19b5512a473b1a7a8b48a35
with:
aws_key_id: ${{ secrets.AWS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws_bucket: fishnet-releases
source_dir: .
destination_dir: ${{ steps.get_version.outputs.VERSION }}