-
Notifications
You must be signed in to change notification settings - Fork 3
81 lines (70 loc) · 1.98 KB
/
go-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
name: Builder
on:
push:
branches: [ main ]
paths-ignore:
- '**.md'
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '>=1.19.0'
- name: Build App
run: |
go mod tidy
CGO_ENABLED=0 GOOS=linux go build -ldflags "-s -w" -o promcasa
- name: Compress App
run: |
strip promcasa
upx promcasa
- name: Get Version Tag
run: |
echo TAG_NAME=$(cat version.go | grep VERSION | awk -F'"' '{print $2}') >> $GITHUB_ENV
- name: Get Time Tag
if: github.event_name != 'pull_request'
id: time
uses: nanzm/[email protected]
with:
timeZone: 0
format: 'YYYYMMDDHHmmss'
- name: NFPM DEB
if: github.event_name != 'pull_request'
uses: skynet-core/[email protected]
id: deb-package
env:
VERSION: ${{ env.TAG_NAME }}
with:
target: promcasa_v${{ env.TAG_NAME }}.deb
config: "examples/promcasa.yml"
packager: "deb"
- name: NFPM RPM
if: github.event_name != 'pull_request'
uses: skynet-core/[email protected]
id: rpm-package
env:
VERSION: ${{ env.TAG_NAME }}
with:
target: promcasa_v${{ env.TAG_NAME }}.rpm
config: "examples/promcasa.yml"
packager: "rpm"
- name: Upload release
if: github.event_name != 'pull_request'
uses: boxpositron/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
release_config: |
promcasa
promcasa_v${{ env.TAG_NAME }}.deb
promcasa_v${{ env.TAG_NAME }}.rpm
tag_name: v${{ steps.time.outputs.time }}
release_name: promcasa_v${{ env.TAG_NAME }}_${{ steps.time.outputs.time }}
draft: false
prerelease: false
overwrite: true