-
Notifications
You must be signed in to change notification settings - Fork 23
82 lines (81 loc) · 2.07 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
name: Build
on:
push:
paths:
- 'Makefile'
- 'go.mod'
- '**.go'
- '.github/workflows/build.yml'
env:
go_version: '1.21'
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: ${{ env.go_version }}
- name: run tests
run: |
go mod download
make test
make pms
make_release:
if: ${{ github.ref == 'refs/heads/master' }}
needs:
- test
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Delete latest release
uses: dev-drprasad/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
delete_release: true
tag_name: latest
- name: Create release
id: create_release
uses: actions/create-release@v1
with:
tag_name: latest
release_name: Latest build
draft: false
prerelease: false
release:
if: ${{ github.ref == 'refs/heads/master' }}
needs:
- make_release
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
strategy:
matrix:
os_arch:
- darwin-amd64
- darwin-arm64
- linux-amd64
- linux-arm64
- linux-arm
- windows-amd64.exe
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: ${{ env.go_version }}
- name: Download dependencies
run: |
go mod download
- name: Build binary
run: make ${{ matrix.os_arch }}
- name: Upload binary
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ needs.make_release.outputs.upload_url }}
asset_path: build/pms-${{ matrix.os_arch }}
asset_name: pms-${{ matrix.os_arch }}
asset_content_type: application/octet-stream