-
Notifications
You must be signed in to change notification settings - Fork 6
130 lines (130 loc) · 4.18 KB
/
test-and-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
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
127
128
129
130
name: "Test & Release"
on:
push:
branches:
- '*'
release:
types:
- created
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- name: Set up Go 1.20
uses: actions/setup-go@v4
with:
go-version: '^1.20'
id: go
- name: Checkout
uses: actions/checkout@v3
- name: Run tests
run: go test -coverprofile c.out ./...
- name: Produce coverage report
run: go tool cover -html=c.out -o coverage.html
- name: Save coverage report as artifact
uses: actions/upload-artifact@master
with:
name: coverage
path: coverage.html
build-linux:
if: ${{ github.event_name == 'release' }}
needs: test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Go 1.20
uses: actions/setup-go@v4
with:
go-version: '^1.20'
- name: Build on Linux
working-directory: ${{ github.workspace }}/cmd/transitland
run: CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build
- name: Store Linux binary
uses: actions/upload-artifact@v3
with:
name: transitland-linux
path: ${{ github.workspace }}/cmd/transitland/transitland
build-macos:
if: ${{ github.event_name == 'release' }}
needs: test
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Go 1.20
uses: actions/setup-go@v4
with:
go-version: '^1.20'
- name: Build on macOS
working-directory: ${{ github.workspace }}/cmd/transitland
run: CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 go build
- name: Import Code-Signing Certificates
uses: Apple-Actions/import-codesign-certs@v1
with:
p12-file-base64: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_P12_BASE64 }}
p12-password: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_PASSWORD }}
- name: Install gon via HomeBrew for code signing and app notarization
run: |
brew tap mitchellh/gon
brew install mitchellh/gon/gon
- name: Sign the mac binaries with Gon
env:
AC_USERNAME: ${{ secrets.AC_USERNAME }}
AC_PASSWORD: ${{ secrets.AC_PASSWORD }}
run: |
gon -log-level=debug -log-json ./.github/gonconfig.json
- name: Store macOS binary
uses: actions/upload-artifact@v3
with:
name: transitland-macos
path: ${{ github.workspace }}/transitland.zip
release:
if: ${{ github.event_name == 'release' }}
needs: [build-linux, build-macos]
runs-on: ubuntu-latest
steps:
- name: Download Linux binary
uses: actions/download-artifact@v3
with:
name: transitland-linux
path: transitland-linux
- name: Attach Linux binary to GitHub release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ${{ github.workspace }}/transitland-linux/transitland
asset_name: transitland-linux
asset_content_type: application/binary
- name: Download macOS binary
uses: actions/download-artifact@v3
with:
name: transitland-macos
path: transitland-macos
- name: Attach macOS binary to GitHub release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ${{ github.workspace }}/transitland-macos/transitland.zip
asset_name: transitland-macos.zip
asset_content_type: application/binary
release-notes:
needs: release
if: ${{ github.event_name == 'release' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '16.x'
- run: npm install github-release-notes -g
- run: gren release --override
env:
GREN_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}