-
Notifications
You must be signed in to change notification settings - Fork 0
126 lines (112 loc) · 4.28 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
name: App build
on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+'
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: App core Setup
uses: ./.github/actions/core-setup
- name: Test app
uses: ./.github/actions/app-test
build:
needs: test
strategy:
fail-fast: false
matrix:
build:
- name: app_build
platform: linux
arch: amd64
os: ubuntu-latest
- name: app_build
platform: windows
arch: amd64
os: windows-latest
- name: app_build
platform: darwin
arch: amd64
os: macos-latest
runs-on: ${{ matrix.build.os }}
steps:
- uses: actions/checkout@v4
- name: App core Setup
uses: ./.github/actions/core-setup
- name: Build app
run: |
mage -v build:release
- name: Set binary variables
id: binary_variables
shell: bash
run: |
case "${{ runner.os }}" in
Linux)
export BINARY_SUFFIX=
;;
Windows)
export BINARY_SUFFIX=.exe
;;
macOS)
export BINARY_SUFFIX=
mv -f "./build/bin/Adrift Native.app/Contents/MacOS/Adrift Native" "./build/bin/adrift-native"
;;
esac
export BINARY_FILENAME=adrift-native${BINARY_SUFFIX}
export RELEASE_VERSION=${{ github.ref_name }}
mage -v release:prepare
export RELEASE_FILENAME=adrift-native_${{ github.ref_name }}_${{ matrix.build.platform }}_${{ matrix.build.arch }}.zip
echo "::set-output name=RELEASE_FILENAME::${RELEASE_FILENAME}"
- name: Upload binary artifact
uses: actions/upload-artifact@v4
with:
name: ${{ steps.binary_variables.outputs.RELEASE_FILENAME }}
path: ./build/bin/${{ steps.binary_variables.outputs.RELEASE_FILENAME }}
#
# Release binaries to various platforms. E.g. FTP server, GitHub releases.
#
release:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Go 1.22.0
uses: actions/setup-go@v5
with:
go-version: '1.22.0'
- name: Setup app Go
shell: bash
run: |
go install github.com/magefile/mage
mage -v bootstrap
- name: Download binary artifacts
uses: actions/download-artifact@v4
with:
path: adrift-native
pattern: adrift-native*
merge-multiple: true
- name: Release to FTP
uses: ./.github/actions/core-release-ftp
with:
ftp_host: ${{ secrets.FTP_HOST }}
ftp_username: ${{ secrets.FTP_USERNAME }}
ftp_password: ${{ secrets.FTP_PASSWORD }}
ftp_path: ${{ secrets.FTP_PATH }}
local_path: ./adrift-native
release_version: ${{ github.ref_name }}
- name: Release to GitHub via tagged-release
id: create_release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref_name }}
name: Release v${{ github.ref_name }}
draft: true
prerelease: false
files: |
./adrift-native/adrift-native_${{ github.ref_name }}_darwin_amd64.zip
./adrift-native/adrift-native_${{ github.ref_name }}_linux_amd64.zip
./adrift-native/adrift-native_${{ github.ref_name }}_windows_amd64.zip