-
Notifications
You must be signed in to change notification settings - Fork 57
95 lines (95 loc) · 3.85 KB
/
build-and-deploy-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
name: build and deploy release
on:
release:
types: [published]
jobs:
build:
if: github.repository == 'QW-Group/mvdsv'
runs-on: ${{ matrix.base-image }}
strategy:
fail-fast: false
matrix:
target: [linux-amd64, linux-i686, linux-armhf, linux-aarch64, windows-x64, windows-x86]
include:
- target: linux-amd64
os: linux
arch: amd64
base-image: ubuntu-latest
build-image: amd64/debian:stable
ext: ""
- target: linux-i686
os: linux
arch: i386
base-image: ubuntu-latest
build-image: i386/debian:stable
ext: ""
- target: linux-armhf
os: linux
arch: arm/v7
base-image: ubuntu-latest
build-image: arm32v7/debian:stable
ext: ""
- target: linux-aarch64
os: linux
arch: arm64
base-image: ubuntu-latest
build-image: arm64v8/debian:stable
ext: ""
- target: windows-x64
os: windows
arch: x64
base-image: ubuntu-latest
ext: ".exe"
- target: windows-x86
os: windows
arch: x86
base-image: ubuntu-latest
ext: ".exe"
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
if: matrix.os == 'linux'
- name: Prepare Build Environemnt
shell: bash
run: sudo apt-get update -qq && sudo apt-get -qq --no-install-recommends install build-essential cmake gcc-mingw-w64-x86-64 gcc-mingw-w64-i686
if: matrix.os == 'windows'
- name: Build
run: |
if ${{ matrix.os == 'linux' }}; then
docker run --platform linux/${{ matrix.arch }} --net=host --rm --device /dev/fuse -v $PWD:/mvdsv -w /mvdsv ${{ matrix.build-image }} bash -c -e '
set -e
apt-get -qq update
apt-get -qq --no-install-recommends install cmake build-essential libcurl4-openssl-dev ninja-build
./build_cmake.sh ${{ matrix.target }}
chown -R '$(id -u ${USER})':'$(id -g ${USER})' build/${{ matrix.target }} || exit 3
'
else
./build_cmake.sh ${{ matrix.target }}
fi
- name: Create checksum
run: |
md5sum build/${{ matrix.target }}/mvdsv${{ matrix.ext }} > build/${{ matrix.target }}/mvdsv.md5
- name: Setup SSH
env:
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
run: |
ssh-agent -a $SSH_AUTH_SOCK > /dev/null
ssh-add - <<< "${{ secrets.SSH_PRIVATE_KEY }}"
- name: Set date
run: |
echo "DATE=$(TZ="Europe/Amsterdam" date "+%Y%m%d-%H%M%S")" >> $GITHUB_ENV
- name: Deploy
env:
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
run: |
mkdir -p upload/releases/${{ github.ref_name }}/${{ matrix.os }}/${{ matrix.arch }}
mkdir -p upload/releases/latest/${{ matrix.os }}/${{ matrix.arch }}
cp build/${{ matrix.target }}/mvdsv${{ matrix.ext }} upload/releases/${{ github.ref_name }}/${{ matrix.os }}/${{ matrix.arch }}/mvdsv${{ matrix.ext }}
cp build/${{ matrix.target }}/mvdsv.md5 upload/releases/${{ github.ref_name }}/${{ matrix.os }}/${{ matrix.arch }}/mvdsv.md5
cp build/${{ matrix.target }}/mvdsv${{ matrix.ext }} upload/releases/latest/${{ matrix.os }}/${{ matrix.arch }}/mvdsv${{ matrix.ext }}
cp build/${{ matrix.target }}/mvdsv.md5 upload/releases/latest/${{ matrix.os }}/${{ matrix.arch }}/mvdsv.md5
sftp -rp -o 'StrictHostKeyChecking no' -o 'UserKnownHostsFile /dev/null' -P ${{ secrets.SFTP_PORT }} ${{ secrets.SFTP_USERNAME }}@${{ secrets.SFTP_HOST }}:/releases <<< $'put -rp upload/releases/*'