|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+name: build
|
|
|
2
|
+
|
|
|
3
|
+# ------------- NOTE
|
|
|
4
|
+# please setup some secrets before running this workflow:
|
|
|
5
|
+# DOCKER_IMAGE should be the target image name on docker hub (e.g. "rustdesk/rustdesk-server" )
|
|
|
6
|
+# DOCKER_USERNAME is the username you normally use to login at https://hub.docker.com/
|
|
|
7
|
+# DOCKER_PASSWORD is a token you should create under "account settings / security" with read/write access
|
|
|
8
|
+
|
|
|
9
|
+on:
|
|
|
10
|
+ workflow_dispatch:
|
|
|
11
|
+ schedule:
|
|
|
12
|
+ - cron: '0 10 * * 2'
|
|
|
13
|
+ push:
|
|
|
14
|
+ tags:
|
|
|
15
|
+ - 'v[0-9]+.[0-9]+.[0-9]+'
|
|
|
16
|
+ - '[0-9]+.[0-9]+.[0-9]+'
|
|
|
17
|
+
|
|
|
18
|
+env:
|
|
|
19
|
+ CARGO_TERM_COLOR: always
|
|
|
20
|
+
|
|
|
21
|
+jobs:
|
|
|
22
|
+
|
|
|
23
|
+ build:
|
|
|
24
|
+
|
|
|
25
|
+ name: Build - ${{ matrix.job.name }}
|
|
|
26
|
+ runs-on: ubuntu-22.04
|
|
|
27
|
+ strategy:
|
|
|
28
|
+ fail-fast: false
|
|
|
29
|
+ matrix:
|
|
|
30
|
+ job:
|
|
|
31
|
+ - { name: "amd64", target: "x86_64-unknown-linux-musl" }
|
|
|
32
|
+ - { name: "arm64v8", target: "aarch64-unknown-linux-musl" }
|
|
|
33
|
+ - { name: "armv7", target: "armv7-unknown-linux-musleabihf" }
|
|
|
34
|
+ - { name: "i386", target: "i686-unknown-linux-musl" }
|
|
|
35
|
+
|
|
|
36
|
+ steps:
|
|
|
37
|
+
|
|
|
38
|
+ - name: Checkout
|
|
|
39
|
+ uses: actions/checkout@v3
|
|
|
40
|
+
|
|
|
41
|
+ - name: Install toolchain
|
|
|
42
|
+ uses: actions-rs/toolchain@v1
|
|
|
43
|
+ with:
|
|
|
44
|
+ toolchain: nightly
|
|
|
45
|
+ override: true
|
|
|
46
|
+ default: true
|
|
|
47
|
+ target: ${{ matrix.job.target }}
|
|
|
48
|
+
|
|
|
49
|
+ - name: Build
|
|
|
50
|
+ uses: actions-rs/cargo@v1
|
|
|
51
|
+ with:
|
|
|
52
|
+ command: build
|
|
|
53
|
+ args: --release --all-features --target=${{ matrix.job.target }}
|
|
|
54
|
+ use-cross: true
|
|
|
55
|
+
|
|
|
56
|
+ # - name: Run tests
|
|
|
57
|
+ # run: cargo test --verbose
|
|
|
58
|
+
|
|
|
59
|
+ - name: Publish Artifacts
|
|
|
60
|
+ uses: actions/upload-artifact@v3
|
|
|
61
|
+ with:
|
|
|
62
|
+ name: binaries-${{ matrix.job.name }}
|
|
|
63
|
+ path: |
|
|
|
64
|
+ target/${{ matrix.job.target }}/release/hbbr
|
|
|
65
|
+ target/${{ matrix.job.target }}/release/hbbs
|
|
|
66
|
+ if-no-files-found: error
|
|
|
67
|
+
|
|
|
68
|
+
|
|
|
69
|
+ release:
|
|
|
70
|
+
|
|
|
71
|
+ name: Github release
|
|
|
72
|
+ needs: build
|
|
|
73
|
+ runs-on: ubuntu-22.04
|
|
|
74
|
+
|
|
|
75
|
+ steps:
|
|
|
76
|
+
|
|
|
77
|
+ - name: Download binaries (amd64)
|
|
|
78
|
+ uses: actions/download-artifact@v3
|
|
|
79
|
+ with:
|
|
|
80
|
+ name: binaries-amd64
|
|
|
81
|
+ path: amd64
|
|
|
82
|
+
|
|
|
83
|
+ - name: Download binaries (arm64v8)
|
|
|
84
|
+ uses: actions/download-artifact@v3
|
|
|
85
|
+ with:
|
|
|
86
|
+ name: binaries-arm64v8
|
|
|
87
|
+ path: arm64v8
|
|
|
88
|
+
|
|
|
89
|
+ - name: Download binaries (armv7)
|
|
|
90
|
+ uses: actions/download-artifact@v3
|
|
|
91
|
+ with:
|
|
|
92
|
+ name: binaries-armv7
|
|
|
93
|
+ path: armv7
|
|
|
94
|
+
|
|
|
95
|
+ - name: Download binaries (i386)
|
|
|
96
|
+ uses: actions/download-artifact@v3
|
|
|
97
|
+ with:
|
|
|
98
|
+ name: binaries-i386
|
|
|
99
|
+ path: i386
|
|
|
100
|
+
|
|
|
101
|
+ - name: Rename files
|
|
|
102
|
+ run: for arch in amd64 arm64v8 armv7 i386 ; do for b in hbbr hbbs ; do mv -v ${arch}/${b} ${arch}/${b}-${arch} ; done ; done
|
|
|
103
|
+
|
|
|
104
|
+ - name: Create Release
|
|
|
105
|
+ uses: softprops/action-gh-release@v1
|
|
|
106
|
+ with:
|
|
|
107
|
+ draft: true
|
|
|
108
|
+ files: |
|
|
|
109
|
+ amd64/*
|
|
|
110
|
+ arm64v8/*
|
|
|
111
|
+ armv7/*
|
|
|
112
|
+ i386/*
|
|
|
113
|
+
|
|
|
114
|
+
|
|
|
115
|
+ docker:
|
|
|
116
|
+
|
|
|
117
|
+ name: Docker push - ${{ matrix.job.name }}
|
|
|
118
|
+ needs: build
|
|
|
119
|
+ runs-on: ubuntu-22.04
|
|
|
120
|
+ strategy:
|
|
|
121
|
+ fail-fast: false
|
|
|
122
|
+ matrix:
|
|
|
123
|
+ job:
|
|
|
124
|
+ - { name: "amd64", docker_platform: "linux/amd64" }
|
|
|
125
|
+ - { name: "arm64v8", docker_platform: "linux/arm64" }
|
|
|
126
|
+ - { name: "armv7", docker_platform: "linux/arm/v7" }
|
|
|
127
|
+ - { name: "i386", docker_platform: "linux/386" }
|
|
|
128
|
+
|
|
|
129
|
+ steps:
|
|
|
130
|
+
|
|
|
131
|
+ - name: Checkout
|
|
|
132
|
+ uses: actions/checkout@v3
|
|
|
133
|
+
|
|
|
134
|
+ - name: Download binaries
|
|
|
135
|
+ uses: actions/download-artifact@v3
|
|
|
136
|
+ with:
|
|
|
137
|
+ name: binaries-${{ matrix.job.name }}
|
|
|
138
|
+ path: docker/rootfs/usr/bin
|
|
|
139
|
+
|
|
|
140
|
+ - name: Make binaries executable
|
|
|
141
|
+ run: chmod -v a+x docker/rootfs/usr/bin/*
|
|
|
142
|
+
|
|
|
143
|
+ - name: Set up QEMU
|
|
|
144
|
+ uses: docker/setup-qemu-action@v2
|
|
|
145
|
+
|
|
|
146
|
+ - name: Set up Docker Buildx
|
|
|
147
|
+ uses: docker/setup-buildx-action@v2
|
|
|
148
|
+
|
|
|
149
|
+ - name: Log in to Docker Hub
|
|
|
150
|
+ if: github.event_name != 'pull_request'
|
|
|
151
|
+ uses: docker/login-action@v2
|
|
|
152
|
+ with:
|
|
|
153
|
+ username: ${{ secrets.DOCKER_USERNAME }}
|
|
|
154
|
+ password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
155
|
+
|
|
|
156
|
+ - name: Extract metadata (tags, labels) for Docker
|
|
|
157
|
+ id: meta
|
|
|
158
|
+ uses: docker/metadata-action@v4
|
|
|
159
|
+ with:
|
|
|
160
|
+ images: registry.hub.docker.com/${{ secrets.DOCKER_IMAGE }}
|
|
|
161
|
+
|
|
|
162
|
+ - name: Build and push Docker image
|
|
|
163
|
+ uses: docker/build-push-action@v3
|
|
|
164
|
+ with:
|
|
|
165
|
+ context: "./docker"
|
|
|
166
|
+ platforms: ${{ matrix.job.docker_platform }}
|
|
|
167
|
+ push: true
|
|
|
168
|
+ tags: "${{ secrets.DOCKER_IMAGE }}:latest-${{ matrix.job.name }}"
|
|
|
169
|
+ labels: ${{ steps.meta.outputs.labels }}
|
|
|
170
|
+
|
|
|
171
|
+
|
|
|
172
|
+ docker-manifest:
|
|
|
173
|
+
|
|
|
174
|
+ name: Docker manifest
|
|
|
175
|
+ needs: docker
|
|
|
176
|
+ runs-on: ubuntu-22.04
|
|
|
177
|
+
|
|
|
178
|
+ steps:
|
|
|
179
|
+
|
|
|
180
|
+ - name: Log in to Docker Hub
|
|
|
181
|
+ if: github.event_name != 'pull_request'
|
|
|
182
|
+ uses: docker/login-action@v2
|
|
|
183
|
+ with:
|
|
|
184
|
+ username: ${{ secrets.DOCKER_USERNAME }}
|
|
|
185
|
+ password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
186
|
+
|
|
|
187
|
+ - name: Create and push manifest
|
|
|
188
|
+ uses: Noelware/docker-manifest-action@master
|
|
|
189
|
+ with:
|
|
|
190
|
+ base-image: ${{ secrets.DOCKER_IMAGE }}:latest
|
|
|
191
|
+ extra-images: ${{ secrets.DOCKER_IMAGE }}:latest-amd64,${{ secrets.DOCKER_IMAGE }}:latest-arm64v8,${{ secrets.DOCKER_IMAGE }}:latest-armv7,${{ secrets.DOCKER_IMAGE }}:latest-i386
|
|
|
192
|
+ push: true
|