forked from johejo/sora_exporter
-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (49 loc) · 1.83 KB
/
release.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
name: Release Build
on:
push:
tags:
- "*"
jobs:
build:
name: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: "./go.mod"
- run: go install github.com/tcnksm/ghr@latest
- name: Build
run: |
VERSION=$(git describe --tag --abbrev=0)
REVISION=$(git rev-parse --short HEAD)
GOOS=linux GOARCH=amd64 go build \
-o dist/sora_exporter_linux_amd64-${VERSION} \
-ldflags "\
-X github.com/prometheus/common/version.Version=${VERSION} \
-X github.com/prometheus/common/version.Revision=${REVISION} \
-X github.com/prometheus/common/version.Branch=main \
-X github.com/prometheus/common/version.BuildUser=shiguredo \
-X github.com/prometheus/common/version.BuildDate=$(date -u "+%Y-%m-%dT%H:%M:%SZ") \
" \
main.go
GOOS=linux GOARCH=arm64 go build \
-o dist/sora_exporter_linux_arm64-${VERSION} \
-ldflags "\
-X github.com/prometheus/common/version.Version=${VERSION} \
-X github.com/prometheus/common/version.Revision=${REVISION} \
-X github.com/prometheus/common/version.Branch=main \
-X github.com/prometheus/common/version.BuildUser=shiguredo \
-X github.com/prometheus/common/version.BuildDate=$(date -u "+%Y-%m-%dT%H:%M:%SZ") \
" \
main.go
gzip dist/*
- name: Release
run: |
ghr -t "${{ secrets.GITHUB_TOKEN }}" \
-u "${{ github.repository_owner }}" \
-r "sora_exporter" \
-n "${{ github.ref }}" \
--replace "${GITHUB_REF##*/}" \
dist/