-
Notifications
You must be signed in to change notification settings - Fork 10
90 lines (74 loc) · 2.57 KB
/
push.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
name: Push
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
jobs:
build:
name: Build
runs-on: ${{ matrix.os }}
if: ${{ !contains(github.event.head_commit.message, 'dev') }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04]
go: ["1.21.4"]
goos: [linux, windows]
goarch: [amd64, arm64]
steps:
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
- name: Code checkout
uses: actions/checkout@v4
- name: go mod download
env:
CGO_ENABLED: 0
run: |
go mod download
- name: Build
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
CGO_ENABLED: 0
run: |
go build -o dist/PalworldServerConfigParser-${{ matrix.goos }}-${{ matrix.goarch }}
if [ "${{ matrix.goos }}" = "windows" ]; then
mv dist/PalworldServerConfigParser-${{ matrix.goos }}-${{ matrix.goarch }} dist/PalworldServerConfigParser-${{ matrix.goos }}-${{ matrix.goarch }}.exe
fi
chmod 755 dist/*
- uses: actions/upload-artifact@v4
if: matrix.goos == 'linux'
with:
name: PalworldServerConfigParser-${{ matrix.goos }}-${{ matrix.goarch }}.zip
path: dist/PalworldServerConfigParser-${{ matrix.goos }}-${{ matrix.goarch }}
- uses: actions/upload-artifact@v4
if: matrix.goos == 'windows'
with:
name: PalworldServerConfigParser-${{ matrix.goos }}-${{ matrix.goarch }}.exe.zip
path: dist/PalworldServerConfigParser-${{ matrix.goos }}-${{ matrix.goarch }}.exe
# release:
# name: Create Release
# runs-on: ubuntu-20.04
# if: startsWith(github.event.head_commit.message, 'Release:')
# steps:
# - uses: actions/checkout@v4
# - name: Extract tag from commit message
# id: extract_tag
# run: |
# echo "::set-output name=tag::$(echo ${{ github.event.head_commit.message }} | grep -oP 'Release: \K(.*)')"
# - name: Create Release
# uses: softprops/action-gh-release@v1
# with:
# files: |
# 'dist/PalworldServerConfigParser-linux-amd64'
# 'dist/PalworldServerConfigParser-linux-arm64'
# 'dist/PalworldServerConfigParser-windows-amd64.exe'
# 'dist/PalworldServerConfigParser-windows-arm64.exe'
# tag_name: v${{ steps.extract_tag.outputs.tag }}
# title: ${{ steps.extract_tag.outputs.tag }}