-
Notifications
You must be signed in to change notification settings - Fork 467
97 lines (84 loc) · 3.38 KB
/
build_macos.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
name: Build Macos
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
env:
UPLOAD_BIN_FILE: true
jobs:
build:
name: Build
strategy:
matrix:
go-version: [ 1.19.x ]
platform: [ macos-latest ]
arch: [ 386, amd64 ]
runs-on: ${{ matrix.platform }}
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v3
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}
- name: Build ${{ matrix.platform }} ${{ matrix.arch }} with Go
if: (matrix.platform == 'ubuntu-latest' || matrix.platform == 'macos-latest') && matrix.arch == 'amd64' && env.UPLOAD_BIN_FILE
id: build_linux_amd64
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
run: |
go mod tidy
export GOARCH=${{ matrix.arch }}
export CGO_ENABLED=1
echo "FATENAME=fate_$(go env GOOS)_$(go env GOARCH)" >> $GITHUB_ENV
echo "$(go env GOOS) $(go env GOARCH)"
echo "building"
go build -o fate_$(go env GOOS)_$(go env GOARCH) -v ./cmd/console
echo "compress"
tar -zcvf fate_$(go env GOOS)_$(go env GOARCH).tar.gz ./fate_$(go env GOOS)_$(go env GOARCH)
- name: Build ${{ matrix.platform }} ${{ matrix.arch }} with Go
if: matrix.platform == 'ubuntu-latest' && matrix.arch == '386' && env.UPLOAD_BIN_FILE
id: build_linux_386
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
run: |
go mod tidy
export GOARCH=${{ matrix.arch }}
export CGO_ENABLED=1
sudo apt-get install -y gcc-i686-linux-gnu g++-i686-linux-gnu
export AR="/usr/bin/i686-linux-gnu-ar -m32"
export CXX="/usr/bin/i686-linux-gnu-cpp -m32"
export CC="/usr/bin/i686-linux-gnu-gcc -m32"
echo "FATENAME=fate_$(go env GOOS)_$(go env GOARCH)" >> $GITHUB_ENV
echo "$(go env GOOS) $(go env GOARCH)"
echo "building"
go build -o fate_$(go env GOOS)_$(go env GOARCH) -v ./cmd/console
echo "compress"
tar -zcvf fate_$(go env GOOS)_$(go env GOARCH).tar.gz ./fate_$(go env GOOS)_$(go env GOARCH)
- name: Upload Linux
uses: actions/upload-artifact@master
if: (matrix.platform == 'ubuntu-latest' || matrix.platform == 'macos-latest') && env.UPLOAD_BIN_FILE
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
with:
name: ${{ env.FATENAME }}.tar.gz
path: ${{ env.FATENAME }}.tar.gz
- name: Create Release
id: create_release_linux
if: (matrix.platform == 'ubuntu-latest' || matrix.platform == 'macos-latest') && env.UPLOAD_BIN_FILE
uses: ncipollo/release-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
with:
artifacts: "${{ env.FATENAME }}.tar.gz"
allowUpdates: true
commit: master
tag: auto_build
body: |
This is only a latest build from master
**Version: https://github.com/babyname/fate/commit/${{ github.sha }}**
token: ${{ secrets.GITHUB_TOKEN }}
draft: false
prerelease: false