forked from uswitch/vault-creds
-
Notifications
You must be signed in to change notification settings - Fork 0
92 lines (84 loc) · 2.62 KB
/
push.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
85
86
87
88
89
90
91
name: push
on: push
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: "1.20"
- run: go test -v -cover $(go list ./... | grep -v /vendor)
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: "1.20"
- run: CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-X main.SHA=${{ github.sha }}" -o bin/vaultcreds cmd/*.go
- uses: actions/upload-artifact@v3
with:
name: bin
path: bin/
docker-build-push:
permissions:
contents: read
packages: write
#if: github.ref_name == 'master' || startsWith(github.ref, 'refs/tags/v')
needs: [test, build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v3
- name: Login to Quay.io
if: github.repository == 'uswitch/vault-creds'
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
- id: meta
if: github.repository == 'uswitch/vault-creds'
uses: docker/metadata-action@v4
with:
images: quay.io/uswitch/vault-creds
tags: |
type=semver,pattern=v{{version}}
type=sha,prefix=,format=long,
- uses: docker/build-push-action@v4
if: github.repository == 'uswitch/vault-creds'
with:
context: .
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
build-args: LDFLAGS=-X main.SHA=${{ github.sha }}
- name: Log into registry ghcr.io
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- id: meta-forks
if: github.repository != 'uswitch/vault-creds'
uses: docker/metadata-action@v4
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=semver,pattern=v{{version}}
type=sha,prefix=,format=long,
- uses: docker/build-push-action@v4
if: github.repository != 'uswitch/vault-creds'
with:
context: .
labels: ${{ steps.meta-forks.outputs.labels }}
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta-forks.outputs.tags }}
build-args: LDFLAGS=-X main.SHA=${{ github.sha }}