-
Notifications
You must be signed in to change notification settings - Fork 0
84 lines (79 loc) · 2.19 KB
/
build.yaml
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
84
name: release
concurrency:
group: release
cancel-in-progress: true
on:
push:
tags:
- 'v*'
jobs:
build:
name: build_and_release
runs-on: ubuntu-latest
steps:
- name: clone
uses: actions/checkout@main
- name: Setup Go
uses: actions/setup-go@main
with:
go-version: 1.22
- name: install depends
run: |
go mod download
mkdir artifacts
- name: build
run: |
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o artifacts/custom-exporter
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags="-s -w" -o artifacts/custom-exporter-arm64
- name: upload artifacts to cache
id: cache-artifacts
uses: actions/cache@main
with:
path: ./artifacts
key: artifacts
container_image:
name: container_image
runs-on: ubuntu-latest
outputs:
pushed-images: ${{ steps.build-images.outputs.pushed-images }}
steps:
- name: Checkout code
uses: actions/checkout@main
- uses: orangeappsru/build-images-action@main
id: build-images
with:
registry: ghcr.io
registry-user: ${{ github.repository_owner }}
registry-password: ${{ secrets.GITHUB_TOKEN }}
github-token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref_name }}
operation: build-and-push
platforms: linux/amd64,linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max
build-opts: |
- name: main
repo-image-name: true
latest: true
- name: alpine
- name: ubuntu
release:
name: release
runs-on: ubuntu-latest
needs: [build, container_image]
steps:
- name: download cache-artifacts
uses: actions/cache/restore@main
with:
path: ./artifacts
key: artifacts
- name: ${{ github.ref_name }}
uses: softprops/action-gh-release@v2
with:
body: |
container images:
```
${{ needs.container_image.outputs.pushed-images }}
```
files: |
./artifacts/*