forked from Neo23x0/yarGen-Go
-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (67 loc) · 2.08 KB
/
build.yml
File metadata and controls
77 lines (67 loc) · 2.08 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
77
name: Build
on:
push:
branches: [ main, master, develop ]
pull_request:
branches: [ main, master, develop ]
workflow_dispatch:
jobs:
build-matrix:
name: Build - ${{ matrix.os }} / ${{ matrix.arch }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
arch: amd64
goos: linux
goarch: amd64
- os: ubuntu-latest
arch: arm64
goos: linux
goarch: arm64
- os: macos-latest
arch: amd64
goos: darwin
goarch: amd64
- os: macos-latest
arch: arm64
goos: darwin
goarch: arm64
- os: windows-latest
arch: amd64
goos: windows
goarch: amd64
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.22'
cache-dependency-path: go.sum
- name: Download dependencies
run: go mod download
- name: Build binaries
shell: bash
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
run: |
mkdir -p build/${{ matrix.goos }}-${{ matrix.goarch }}
if [ "${{ matrix.goos }}" == "windows" ]; then
EXT=".exe"
else
EXT=""
fi
echo "Building yargen for ${{ matrix.goos }}/${{ matrix.goarch }}..."
go build -o build/${{ matrix.goos }}-${{ matrix.goarch }}/yargen$EXT ./cmd/yargen
echo "Building yargen-util for ${{ matrix.goos }}/${{ matrix.goarch }}..."
go build -o build/${{ matrix.goos }}-${{ matrix.goarch }}/yargen-util$EXT ./cmd/yargen-util
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: binaries-${{ matrix.goos }}-${{ matrix.goarch }}
path: build/${{ matrix.goos }}-${{ matrix.goarch }}/*
retention-days: 7