-
Notifications
You must be signed in to change notification settings - Fork 0
84 lines (73 loc) · 2.05 KB
/
multibuild.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
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
name: Build Go Project
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
name: Build for ${{ matrix.os }}-${{ matrix.arch }}
runs-on: ubuntu-latest
strategy:
matrix:
include:
- os: windows
arch: amd64
- os: windows
arch: 386
- os: linux
arch: arm64
- os: linux
arch: amd64
- os: darwin
arch: amd64
- os: darwin
arch: arm64
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.21'
- name: Build
env:
GOOS: ${{ matrix.os }}
GOARCH: ${{ matrix.arch }}
run: |
output_name="translator-${{ matrix.os }}-${{ matrix.arch }}"
if [ "${{ matrix.os }}" = "windows" ]; then
output_name="${output_name}.exe"
fi
go build -v -o ${output_name} .
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: translator-${{ matrix.os }}-${{ matrix.arch }}
path: translator-${{ matrix.os }}-${{ matrix.arch }}*
create-release:
needs: build
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- name: Get current date
id: getdate
run: echo "::set-output name=getdate::$(date +'%Y.%m.%d-%H%M')"
- uses: actions/checkout@v4
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.getdate.outputs.getdate }}
release_name: Release ${{ steps.getdate.outputs.getdate }}
draft: false
prerelease: false
- uses: actions/download-artifact@v4
- name: Upload Release Assets
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
for artifact in translator-*; do
gh release upload v${{ steps.getdate.outputs.getdate }} $artifact/*
done