-
Notifications
You must be signed in to change notification settings - Fork 0
127 lines (112 loc) · 5.04 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
on:
push:
branches:
- main
name: Build and Release
jobs:
build_and_release:
runs-on: ubuntu-latest
env: # Define environment variables here
TAG: latest
RELEASE_NAME: Latest release
RELEASE_BODY: Latest release
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BINARY_PREFIX: releaseMaker
SOURCE_PATH: .
steps:
- name: Checkout the repository
uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: '*' # Use the latest stable version of Go
- name: Install dependencies
run: go mod download
- name: Download releaseMaker
run: wget https://github.com/8ff/releaseMaker/releases/download/latest/releaseMaker.linux.amd64 -O /tmp/releaseMaker && chmod +x /tmp/releaseMaker
- name: Build Darwin ARM64 binary
working-directory: ${{ env.SOURCE_PATH }}
env:
OS: darwin
ARCH: arm64
run: GOOS=$OS GOARCH=$ARCH go build -ldflags "-X 'main.Version=$(date +'%Y-%m-%d_%H:%M:%S')'" -o "/tmp/build/${{ env.BINARY_PREFIX }}.$OS.$ARCH"
- name: Build Darwin AMD64 binary
working-directory: ${{ env.SOURCE_PATH }}
env:
OS: darwin
ARCH: amd64
run: GOOS=$OS GOARCH=$ARCH go build -ldflags "-X 'main.Version=$(date +'%Y-%m-%d_%H:%M:%S')'" -o "/tmp/build/${{ env.BINARY_PREFIX }}.$OS.$ARCH"
- name: Build Linux ARM64 binary
working-directory: ${{ env.SOURCE_PATH }}
env:
OS: linux
ARCH: arm64
run: GOOS=$OS GOARCH=$ARCH go build -ldflags "-X 'main.Version=$(date +'%Y-%m-%d_%H:%M:%S')'" -o "/tmp/build/${{ env.BINARY_PREFIX }}.$OS.$ARCH"
- name: Build Linux AMD64 binary
working-directory: ${{ env.SOURCE_PATH }}
env:
OS: linux
ARCH: amd64
run: GOOS=$OS GOARCH=$ARCH go build -ldflags "-X 'main.Version=$(date +'%Y-%m-%d_%H:%M:%S')'" -o "/tmp/build/${{ env.BINARY_PREFIX }}.$OS.$ARCH"
- name: Build Windows AMD64 binary
working-directory: ${{ env.SOURCE_PATH }}
env:
OS: windows
ARCH: amd64
run: GOOS=$OS GOARCH=$ARCH go build -ldflags "-X 'main.Version=$(date +'%Y-%m-%d_%H:%M:%S')'" -o "/tmp/build/${{ env.BINARY_PREFIX }}.$OS.$ARCH.exe"
- name: Build Windows ARM64 binary
working-directory: ${{ env.SOURCE_PATH }}
env:
OS: windows
ARCH: arm64
run: GOOS=$OS GOARCH=$ARCH go build -ldflags "-X 'main.Version=$(date +'%Y-%m-%d_%H:%M:%S')'" -o "/tmp/build/${{ env.BINARY_PREFIX }}.$OS.$ARCH.exe"
- name: Build OpenBSD AMD64 binary
working-directory: ${{ env.SOURCE_PATH }}
env:
OS: openbsd
ARCH: amd64
run: GOOS=$OS GOARCH=$ARCH go build -ldflags "-X 'main.Version=$(date +'%Y-%m-%d_%H:%M:%S')'" -o "/tmp/build/${{ env.BINARY_PREFIX }}.$OS.$ARCH"
- name: Build OpenBSD ARM64 binary
working-directory: ${{ env.SOURCE_PATH }}
env:
OS: openbsd
ARCH: arm64
run: GOOS=$OS GOARCH=$ARCH go build -ldflags "-X 'main.Version=$(date +'%Y-%m-%d_%H:%M:%S')'" -o "/tmp/build/${{ env.BINARY_PREFIX }}.$OS.$ARCH"
- name: Build FreeBSD AMD64 binary
working-directory: ${{ env.SOURCE_PATH }}
env:
OS: freebsd
ARCH: amd64
run: GOOS=$OS GOARCH=$ARCH go build -ldflags "-X 'main.Version=$(date +'%Y-%m-%d_%H:%M:%S')'" -o "/tmp/build/${{ env.BINARY_PREFIX }}.$OS.$ARCH"
- name: Build FreeBSD ARM64 binary
working-directory: ${{ env.SOURCE_PATH }}
env:
OS: freebsd
ARCH: arm64
run: GOOS=$OS GOARCH=$ARCH go build -ldflags "-X 'main.Version=$(date +'%Y-%m-%d_%H:%M:%S')'" -o "/tmp/build/${{ env.BINARY_PREFIX }}.$OS.$ARCH"
- name: Build NetBSD AMD64 binary
working-directory: ${{ env.SOURCE_PATH }}
env:
OS: netbsd
ARCH: amd64
run: GOOS=$OS GOARCH=$ARCH go build -ldflags "-X 'main.Version=$(date +'%Y-%m-%d_%H:%M:%S')'" -o "/tmp/build/${{ env.BINARY_PREFIX }}.$OS.$ARCH"
- name: Build NetBSD ARM64 binary
working-directory: ${{ env.SOURCE_PATH }}
env:
OS: netbsd
ARCH: arm64
run: GOOS=$OS GOARCH=$ARCH go build -ldflags "-X 'main.Version=$(date +'%Y-%m-%d_%H:%M:%S')'" -o "/tmp/build/${{ env.BINARY_PREFIX }}.$OS.$ARCH"
- name: Build DragonFly BSD AMD64 binary
working-directory: ${{ env.SOURCE_PATH }}
env:
OS: dragonfly
ARCH: amd64
run: GOOS=$OS GOARCH=$ARCH go build -ldflags "-X 'main.Version=$(date +'%Y-%m-%d_%H:%M:%S')'" -o "/tmp/build/${{ env.BINARY_PREFIX }}.$OS.$ARCH"
- name: Replace Existing Release
run: /tmp/releaseMaker replace ${{ github.repository }} ${{ env.TAG }} "${{ env.RELEASE_NAME }}" "${{ env.RELEASE_BODY }}"
- name: Upload the artifacts
run: |
cd /tmp/build
for file in *; do
/tmp/releaseMaker upload ${{ github.repository }} ${{ env.TAG }} $file $file
done