forked from prometheus-community/stackdriver_exporter
-
Notifications
You must be signed in to change notification settings - Fork 0
97 lines (82 loc) · 2.43 KB
/
Copy pathrelease.yml
File metadata and controls
97 lines (82 loc) · 2.43 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
name: Publish Docker image
on:
push:
branches: [master]
tags:
- "v[0-9]+.[0-9]+.[0-9]+*"
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
cross-compile:
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: "1.21"
- name: Cache Go
id: go-cache
uses: actions/cache@v3
with:
path: |
~/go/bin
~/go/pkg/mod
key: go-cache-${{ runner.os }}-${{ hashFiles('**/go.sum') }}
- name: Install promu
run: make promu
shell: bash
- name: Build
run: ~/go/bin/promu -c .promu.yml crossbuild -v -p linux/amd64 -p linux/arm64 -p darwin/amd64 -p darwin/arm64
- name: Upload Binaries
uses: actions/upload-artifact@v4
with:
name: binaries
path: .build/*
include-hidden-files: true
push_to_registries:
name: Push Docker image
runs-on: ubuntu-latest
needs: [cross-compile]
permissions:
attestations: write
packages: write
contents: read
id-token: write
if: (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v'))
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Download Binaries
uses: actions/download-artifact@v4
with:
name: binaries
path: .build/
include-hidden-files: true
- run: chmod +x .build/**/*
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: build and push
uses: docker/build-push-action@v5
with:
push: true
context: .
file: Dockerfile
platforms: linux/amd64,linux/arm64,darwin/arm64,darwin/amd64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}