-
Notifications
You must be signed in to change notification settings - Fork 42
113 lines (90 loc) · 3.01 KB
/
build-and-release.yml
File metadata and controls
113 lines (90 loc) · 3.01 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
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
# This workflow will: build gomud for multiple os/architectures
# archive the binaries and create a new release for users to easily download
name: Build and release
on:
push:
branches: [master]
permissions:
contents: write
env:
RELEASE_FILENAME: go-mud-release
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "1.23"
- name: Run tests
run: go test ./...
build:
runs-on: ubuntu-latest
needs: "test"
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "1.23"
- name: Create bin directory
run: mkdir -p bin/
- name: Copy _datafiles to bin/
run: cp -r _datafiles bin/
- name: Build windows amd64
run: env GOOS=windows GOARCH=amd64 go build -v -o bin/go-mud-windows_x64.exe .
- name: Build darwin/arm64
run: env GOOS=darwin GOARCH=arm64 go build -v -o bin/go-mud-darwin_arm64 .
- name: Build darwin/amd64
run: env GOOS=darwin GOARCH=amd64 go build -v -o bin/go-mud-darwin_x64 .
- name: Build linux/amd64
run: env GOOS=linux GOARCH=amd64 go build -v -o bin/go-mud-linux_x64 .
- name: Build linux/arm5
run: env GOOS=linux GOARCH=arm GOARM=5 go build -v -o bin/go-mud-linux_arm5 .
- name: Upload bin
uses: actions/upload-artifact@v4
with:
name: bin-artifact
path: bin/
release:
runs-on: ubuntu-latest
needs: "build"
steps:
- uses: actions/checkout@v4
- name: Download builds
uses: actions/download-artifact@v4
with:
name: bin-artifact
path: bin/
- name: Set short git commit SHA
id: vars
run: |
calculatedSha=$(git rev-parse --short ${{ github.sha }})
echo "COMMIT_SHORT_SHA=$calculatedSha" >> $GITHUB_ENV
- name: Archive release
uses: thedoctor0/zip-release@master
id: zip-binaries
with:
type: zip
directory: bin
filename: ${{ env.RELEASE_FILENAME }}-${{ env.COMMIT_SHORT_SHA }}.zip
- name: Release with notes
uses: softprops/action-gh-release@v1
with:
files: bin/${{ env.RELEASE_FILENAME }}-${{ env.COMMIT_SHORT_SHA }}.zip
tag_name: release-${{ env.COMMIT_SHORT_SHA }}
fail_on_unmatched_files: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
message:
runs-on: ubuntu-latest
steps:
- name: Discord Webhook Action
uses: tsickert/discord-webhook@v7.0.0
with:
webhook-url: ${{ secrets.DISCORD_WEBHOOK_URL }}
embed-author-name: ${{ github.event.pull_request.user.login }}
embed-title: "🎉 New update on `master` branch ! **${{ github.event.pull_request.title }}**"
embed-description: ${{ github.event.pull_request.body }}
embed-url: ${{ github.event.pull_request.html_url }}