This repository was archived by the owner on Apr 10, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
73 lines (68 loc) · 1.9 KB
/
Copy pathbuild.yml
File metadata and controls
73 lines (68 loc) · 1.9 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
name: build
on:
push:
branches:
- main
tags:
- "v*"
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: checkout repository
uses: actions/checkout@v6.0.2
- name: setup golang
uses: actions/setup-go@v6.2.0
with:
go-version-file: "go.mod"
- name: build project
env:
GOOS: linux
GOARCH: amd64
run: go build -tags netgo -o build/exporter main.go
- name: store binary
uses: actions/upload-artifact@v6.0.0
with:
name: exporter
path: build/exporter
docker:
runs-on: ubuntu-latest
needs: [build]
steps:
- name: checkout repository
uses: actions/checkout@v6.0.2
- name: download binary
uses: actions/download-artifact@v7.0.0
with:
name: exporter
path: build
- name: login to github registry
uses: docker/login-action@v3.7.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: build development image
uses: docker/build-push-action@v6.19.0
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
with:
context: .
tags: ghcr.io/${{ github.repository }}:development
push: ${{ github.ref == 'refs/heads/main' }}
- name: build latest image
uses: docker/build-push-action@v6.19.0
if: ${{ startsWith(github.ref, 'refs/tags/') }}
with:
context: .
tags: ghcr.io/${{ github.repository }}:${{ github.ref_name }},ghcr.io/${{ github.repository }}:latest
push: true
release:
runs-on: ubuntu-latest
needs: [docker]
if: ${{ startsWith(github.ref, 'refs/tags/') }}
steps:
- name: create new github release
uses: softprops/action-gh-release@v2.5.0