forked from rustdesk/rustdesk-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
793a954
commit c7485ea
Showing
1 changed file
with
113 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
name: build | ||
|
||
# ------------- NOTE | ||
# please setup some secrets before running this workflow: | ||
# DOCKER_IMAGE should be the target image name on docker hub (e.g. "rustdesk/rustdesk-server-s6" ) | ||
# DOCKER_USERNAME is the username you normally use to login at https://hub.docker.com/ | ||
# DOCKER_PASSWORD is a token you should create under "account settings / security" with read/write access | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
tags: | ||
- 'v[0-9]+.[0-9]+.[0-9]+' | ||
- '[0-9]+.[0-9]+.[0-9]+' | ||
- 'v[0-9]+.[0-9]+.[0-9]+-[0-9]+' | ||
- '[0-9]+.[0-9]+.[0-9]+-[0-9]+' | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
LATEST_TAG: latest | ||
|
||
jobs: | ||
|
||
# binary build | ||
build: | ||
|
||
name: Build - ${{ matrix.job.name }} | ||
runs-on: ubuntu-20.04 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
job: | ||
- { name: "amd64", target: "x86_64-unknown-linux-musl" } | ||
- { name: "arm64v8", target: "aarch64-unknown-linux-musl" } | ||
- { name: "armv7", target: "armv7-unknown-linux-musleabihf" } | ||
- { name: "i386", target: "i686-unknown-linux-musl" } | ||
- { name: "amd64fb", target: "x86_64-unknown-freebsd" } | ||
|
||
steps: | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: "1.70.0" | ||
override: true | ||
default: true | ||
components: rustfmt | ||
profile: minimal | ||
target: ${{ matrix.job.target }} | ||
|
||
- name: Build | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: build | ||
args: --release --all-features --target=${{ matrix.job.target }} | ||
use-cross: true | ||
|
||
- name: Exec chmod | ||
run: chmod -v a+x target/${{ matrix.job.target }}/release/* | ||
|
||
- name: Publish Artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: binaries-linux-${{ matrix.job.name }} | ||
path: | | ||
target/${{ matrix.job.target }}/release/hbbr | ||
target/${{ matrix.job.target }}/release/hbbs | ||
target/${{ matrix.job.target }}/release/rustdesk-utils | ||
if-no-files-found: error | ||
|
||
# docker build and push of multiarch images | ||
docker-manifest: | ||
|
||
name: Docker manifest | ||
needs: docker | ||
runs-on: ubuntu-22.04 | ||
|
||
steps: | ||
|
||
- name: Log in to Docker Hub | ||
if: github.event_name != 'pull_request' | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
|
||
- name: Get git branch name | ||
id: vars | ||
run: | | ||
# Extract the branch name from the GITHUB_REF environment variable | ||
T=${GITHUB_REF#refs/heads/} | ||
echo "BRANCH=$T" >> $GITHUB_ENV | ||
|
||
# manifest for :branch tag | ||
- name: Create and push manifest (:major) | ||
uses: Noelware/docker-manifest-action@master | ||
with: | ||
base-image: ${{ secrets.DOCKER_IMAGE }}:${{ env.BRANCH }} | ||
# extra-images: ${{ secrets.DOCKER_IMAGE }}:${{ env.BRANCH }}-amd64,${{ secrets.DOCKER_IMAGE }}:${{ env.BRANCH }}-arm64v8,${{ secrets.DOCKER_IMAGE }}:${{ env.BRANCH }}-armv7,${{ secrets.DOCKER_IMAGE }}:${{ env.BRANCH }}-i386 | ||
push: true | ||
|
||
# manifest for :latest tag | ||
- name: Create and push manifest (:latest) | ||
uses: Noelware/docker-manifest-action@master | ||
with: | ||
base-image: ${{ secrets.DOCKER_IMAGE }}:${{ env.LATEST_TAG }} | ||
# extra-images: ${{ secrets.DOCKER_IMAGE }}:${{ env.LATEST_TAG }}-amd64,${{ secrets.DOCKER_IMAGE }}:${{ env.LATEST_TAG }}-arm64v8,${{ secrets.DOCKER_IMAGE }}:${{ env.LATEST_TAG }}-armv7,${{ secrets.DOCKER_IMAGE }}:${{ env.LATEST_TAG }}-i386 | ||
push: true |