-
Notifications
You must be signed in to change notification settings - Fork 2
76 lines (64 loc) · 2.18 KB
/
build-mac.yml
File metadata and controls
76 lines (64 loc) · 2.18 KB
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
name: GitHub Build and Package Mac
on:
push:
branches:
- master
release:
types:
- created
jobs:
build:
runs-on: ubuntu-latest
env:
ImageName: 'devopcorner/k8s-context'
AppName: 'k8s-context'
strategy:
matrix:
os: [macos-latest]
arch: [arm64]
steps:
- name: Checkout code at release tag
uses: actions/checkout@v2
with:
ref: ${{ github.ref }}
- name: Set up Go environment
uses: actions/setup-go@v2
with:
go-version: 1.19
- name: Install dependencies
working-directory: src
run: |
go mod tidy
- name: Build binary
working-directory: src
run: |
GOOS=${{ matrix.os }}
GOARCH=${{ matrix.arch }}
go build -o ${{ env.AppName }}-${{ matrix.os }}-${{ matrix.arch }} main.go
- name: Install Xcode command line tools
working-directory: src
if: matrix.os == 'macos-latest'
run: |
xcode-select --install || true
- name: Create .pkg package for macOS ARM64
working-directory: src
if: matrix.os == 'macos-latest'
run: |
mkdir -p pkgroot/usr/local/bin/
cp -r ${{ env.AppName }}-macos-latest-${{ matrix.arch }} pkgroot/usr/local/bin/${{ env.AppName }}
pkgbuild --identifier com.${{ env.AppName }}.pkg --version ${{ github.ref_name }} --install-location /usr/local/bin pkgroot ${{ env.AppName }}-${{ matrix.os }}-${{ matrix.arch }}.pkg
rm -rf pkgroot || true
- name: Create .zip package for macOS ARM64
working-directory: src
if: matrix.os == 'macos-latest'
run: |
mkdir -p ${env.AppName}-macos-${{ matrix.arch }}
cp -r ${{ env.AppName }}-macos-latest-${{ matrix.arch }} ${env.AppName}-macos-${{ matrix.arch }}/${env.AppName}}
zip -r ${env.AppName}-macos-${{ matrix.arch }}.zip ${env.AppName}-macos-${{ matrix.arch }}/
- name: Upload packages
uses: actions/upload-artifact@v2
with:
name: ${{ env.AppName }}
path: |
${env.AppName}-macos-arm64.pkg
${env.AppName}-macos-arm64.zip