-
Notifications
You must be signed in to change notification settings - Fork 0
158 lines (155 loc) · 4.8 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
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
name: Release
on:
workflow_dispatch:
push:
tags:
- "v*"
jobs:
build_frontend:
name: Build frontend
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: "yarn"
cache-dependency-path: skynet/frontend/yarn.lock
- run: yarn
working-directory: skynet/frontend
- run: yarn build
working-directory: skynet/frontend
- uses: actions/upload-artifact@v4
with:
name: frontend
path: skynet/frontend/dist
retention-days: 1
build_skynet:
needs: build_frontend
name: Build skynet ${{ matrix.platform.os_name }}
runs-on: ${{ matrix.platform.os }}
strategy:
matrix:
platform:
- os_name: linux-x86_64
os: ubuntu-latest
target: x86_64-unknown-linux-gnu
bin: skynet
name: skynet-linux-x86_64.tar.gz
- os_name: linux-i686
os: ubuntu-latest
target: i686-unknown-linux-gnu
bin: skynet
name: skynet-linux-i686.tar.gz
- os_name: linux-aarch64
os: ubuntu-latest
target: aarch64-unknown-linux-gnu
bin: skynet
name: skynet-linux-aarch64.tar.gz
- os_name: windows-x86_64
os: windows-latest
target: x86_64-pc-windows-gnu
bin: skynet.exe
name: skynet-windows-x86_64.zip
- os_name: macOS-x86_64
os: macOS-latest
target: x86_64-apple-darwin
bin: skynet
name: skynet-darwin-x86_64.tar.gz
- os_name: macOS-aarch64
os: macOS-latest
target: aarch64-apple-darwin
bin: skynet
name: skynet-darwin-aarch64.tar.gz
steps:
- uses: actions/checkout@v4
- name: Cache cargo & target directories
uses: Swatinem/rust-cache@v2
- uses: ilammy/setup-nasm@v1
- name: Install Protoc
id: protoc-install
uses: arduino/setup-protoc@v3
with:
version: "27.3"
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Set protoc path
shell: bash
run: |
echo "${{ steps.protoc-install.outputs.path }}" >> $GITHUB_PATH
- name: Build binary
uses: houseabsolute/actions-rust-cross@v0
with:
command: "both"
target: ${{ matrix.platform.target }}
args: "--locked --release"
strip: false
- uses: actions/download-artifact@v4
with:
name: frontend
path: release/skynet/assets
- name: Package as archive
shell: bash
run: |
cd release
mkdir skynet/plugin
mkdir skynet/assets/_plugin
cp ../target/${{ matrix.platform.target }}/release/${{ matrix.platform.bin }} skynet
cp ../conf.yml skynet
cp ../conf.schema.json skynet
cp ../default.webp skynet
if [[ "${{ matrix.platform.os }}" == "windows-latest" ]]; then
7z a ../${{ matrix.platform.name }} skynet
else
tar czvf ../${{ matrix.platform.name }} skynet
fi
cd -
- uses: actions/upload-artifact@v4
with:
name: skynet-${{ matrix.platform.os_name }}
path: ${{ matrix.platform.name }}
retention-days: 1
- name: Generate SHA-256
run: shasum -a 256 ${{ matrix.platform.name }} > ${{ matrix.platform.name }}.sha256
- name: Publish GitHub release
uses: softprops/action-gh-release@v2
with:
draft: true
files: ${{ matrix.platform.name }}*
push_dockerhub:
needs: build_skynet
name: Push to dockerhub
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Log in
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: imwxz/skynet
- uses: actions/download-artifact@v4
with:
path: release
pattern: skynet-linux-*
merge-multiple: true
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- run: |
cd release
tar xzvf skynet-linux-x86_64.tar.gz
mv skynet amd64
tar xzvf skynet-linux-aarch64.tar.gz
mv skynet arm64
cd -
- name: Build and push aarch64
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}