-
Notifications
You must be signed in to change notification settings - Fork 1
59 lines (51 loc) · 1.61 KB
/
release.yaml
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
name: Release Builds
on:
release:
types: [created]
permissions: write-all
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: [1.22]
os: [linux, windows, darwin]
arch: [amd64, arm64]
include:
- os: windows
extension: .exe
- os: linux
extension: ''
- os: darwin
extension: ''
name: Build for ${{ matrix.os }}/${{ matrix.arch }}
steps:
- name: Set Swap Space
uses: pierotofy/set-swap-space@master
with:
swap-size-gb: 10
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}
- name: Build
env:
GOOS: ${{ matrix.os }}
GOARCH: ${{ matrix.arch }}
run: |
go build -o mhmods-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.extension }}
- name: Compress binary
run: |
FILES="mhmods-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.extension }}"
[ -f LICENSE ] && FILES="$FILES LICENSE"
[ -f README.md ] && FILES="$FILES README.md"
tar -czvf mhmods-${{ matrix.os }}-${{ matrix.arch }}.tar.gz $FILES
- uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: mhmods-${{ matrix.os }}-${{ matrix.arch }}.tar.gz
asset_name: mhmods-${{ matrix.os }}-${{ matrix.arch }}.tar.gz
asset_content_type: application/gzip