-
Notifications
You must be signed in to change notification settings - Fork 1
147 lines (134 loc) · 4.29 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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
name: Build
on:
release:
types: [published]
env:
IMAGE_REGISTRY: ghcr.io
IMAGE_OWNER: hotarublaze
IMAGE_NAME: gotes3mp
jobs:
build-linux-x64:
name: Build Linux - x64
runs-on: ubuntu-latest
permissions:
contents: write
discussions: write
steps:
- uses: actions/checkout@v4
- name: Set up Go 1.x
uses: actions/setup-go@v4
with:
go-version: ^1.22
stable: true
id: linux-build
- name: Run Tests
run: go test ./src/...
- name: Build-Linux
run: CGO_ENABLED=0 go build -ldflags="-X 'main.Build=${{ github.event.release.tag_name }}' -X 'main.GitCommit=$GITHUB_SHA'" -o build/goTES3MP-Linux src/*.go
- name: Generate default config
run: cd build/ && chmod +x goTES3MP-Linux && ./goTES3MP-Linux
- name: GH Release
uses: softprops/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: |
build/goTES3MP-Linux
build/config.yaml
build-linux-aarch64:
name: Build Linux - aarch64
runs-on: self-hosted
permissions:
contents: write
discussions: write
steps:
- uses: actions/checkout@v4
- name: Set up Go 1.x
uses: actions/setup-go@v4
with:
go-version: ^1.22
stable: true
id: linux-build
- name: Run Tests
run: go test ./src/...
- name: Build-Linux
run: CGO_ENABLED=0 go build -ldflags="-X 'main.Build=${{ github.event.release.tag_name }}' -X 'main.GitCommit=$GITHUB_SHA'" -o build/goTES3MP-Linux-aarm64 src/*.go
- name: Generate default config
run: cd build/ && chmod +x goTES3MP-Linux-aarm64 && ./goTES3MP-Linux-aarm64
- name: GH Release
uses: softprops/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: |
build/goTES3MP-Linux-aarm64
build/config.yaml
build-windows:
name: Build Windows
runs-on: ubuntu-latest
permissions:
contents: write
discussions: write
steps:
- uses: actions/checkout@v3
- name: Set up Go 1.x
uses: actions/setup-go@v3
with:
go-version: ^1.22
stable: true
id: windows-build
- name: Run Tests
run: go test ./src
- name: Build-Windows
run: CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags="-X 'main.Build=${{ github.event.release.tag_name }}' -X 'main.GitCommit=$GITHUB_SHA'" -o build/goTES3MP-Windows.exe src/*.go
- name: GH Release
uses: softprops/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: build/goTES3MP-Windows.exe
add-scripts:
name: Add Scripts
runs-on: ubuntu-latest
permissions:
contents: write
discussions: write
steps:
- uses: actions/checkout@v3
- name: Compress scripts
uses: papeloto/[email protected]
with:
files: tes3mp/
dest: build/tes3mp-scripts.zip
- name: GH Release
uses: softprops/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: build/tes3mp-scripts.zip
build-dockerImage:
runs-on: ubuntu-latest
env:
DOCKER_CONFIG: $HOME/.docker
steps:
- uses: actions/checkout@v3
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
- name: Login to ghcr.io
uses: docker/login-action@v3
with:
registry: ${{ env.IMAGE_REGISTRY }}
username: ${{ env.IMAGE_OWNER }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build Docker Image
id: docker_build_x64
uses: docker/build-push-action@v5
with:
push: true
platforms: linux/amd64
labels: org.opencontainers.image.source https://github.com/${{ env.IMAGE_OWNER }}/${{ env.IMAGE_NAME }}
tags: ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_OWNER }}/${{ env.IMAGE_NAME }}:${{ github.event.release.tag_name }}
build-args: |
BUILD_VERSION=${{ github.event.release.tag_name }}
GITHUB_SHA=$GITHUB_SHA