-
-
Notifications
You must be signed in to change notification settings - Fork 11
75 lines (63 loc) · 1.81 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
name: Build all
on:
push:
branches:
- "!*"
- "master"
tags:
- "v*"
pull_request:
branches: [ master ]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Golang
uses: actions/setup-go@v5
with:
go-version: 1.21
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.11.0
- name: Get Go Deps
run: go get -v ./...
- name: Get version
id: vars
run: |
echo "BUILD_DATE=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_ENV
echo "GIT_COMMIT=$(git rev-parse HEAD)" >> $GITHUB_ENV
echo "GIT_TAG=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
- name: Build
env:
IMGUR_CLIENT_ID: ${{ secrets.IMGUR_CLIENT_ID }}
run: >-
python3 gox.py
-osarch="linux/386 linux/amd64 linux/arm linux/arm64 darwin/amd64 darwin/arm64 windows/amd64 windows/386"
-output "build/{{.Dir}}_{{.OS}}_{{.Arch}}"
-ldflags "-w -s -X github.com/slurdge/goeland/version.GitCommit=$GIT_COMMIT -X github.com/slurdge/goeland/version.BuildDate=$BUILD_DATE -X github.com/slurdge/goeland/internal/goeland/fetch.clientID=$IMGUR_CLIENT_ID"
# Commented out because
# MacOS seems unsupported
# False positive with Antivirus
# - name: Run UPX
# uses: crazy-max/ghaction-upx@v3
# with:
# version: latest
# files: |
# ./build/*
# args: -q --lzma --best
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
append_body: true
files: |
./build/*
- name: Archive build
uses: actions/upload-artifact@v3
with:
name: Build
path: build