-
-
Notifications
You must be signed in to change notification settings - Fork 54
83 lines (71 loc) · 1.99 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
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
name: Makefile CI
on:
push:
tags:
- "v*"
branches:
- "master"
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
arch: [386, amd64, arm64]
include:
- arch: arm
armver: 6
- arch: arm
armver: 7
env:
arch_name: ${{ matrix.arch }}${{ matrix.arch == 'arm' && 'v' || '' }}${{ matrix.armver }}
name: Build for ${{ matrix.arch }}${{ matrix.arch == 'arm' && 'v' || '' }}${{ matrix.armver }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Go environment
uses: actions/setup-go@v4
with:
# Path to the go.mod or go.work file.
go-version-file: go.mod
- name: Build ${{ env.arch_name }} binary
run: make build
env:
GOARCH: ${{ matrix.arch }}
GOARM: ${{ matrix.armver }}
- name: Rename ${{ env.arch_name }} binary
run: mv bin/squid-exporter bin/squid-exporter-linux-${{ env.arch_name }}
- name: Upload binary
uses: actions/upload-artifact@v3
with:
name: binary
path: bin/*
release:
runs-on: ubuntu-latest
steps:
- name: Download binaries for release
uses: actions/download-artifact@v3
with:
name: binary
path: bin
- name: Release latest version
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: bin/squid-exporter-*
file_glob: true
tag: unstable
overwrite: true
body: "pre-release"
prerelease: true
- name: Release tag version
if: startsWith(github.ref, 'refs/tags/v')
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: bin/squid-exporter-*
file_glob: true
tag: ${{ github.ref }}
overwrite: true
body: "Stable release"
needs: [build]