-
Notifications
You must be signed in to change notification settings - Fork 39
69 lines (62 loc) · 2.33 KB
/
Copy pathimage.yaml
File metadata and controls
69 lines (62 loc) · 2.33 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
name: image
on:
push:
tags:
- 'v*'
permissions:
contents: read
packages: write
id-token: write
jobs:
image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: v1.24.0
check-latest: true
# We need this to remove local tags that are not semver so goreleaser doesn't get confused.
- name: Delete non-semver tags
run: 'git tag -d $(git tag -l | grep -v "^v")'
# If you notice signing errors, you may need to update the cosign version.
- uses: sigstore/cosign-installer@v3.7.0
- name: Install ko
run: go install github.com/google/ko@latest
- name: Set LDFLAGS
run: echo LDFLAGS="$(make ldflags)" | tee -a >> $GITHUB_ENV
# Build ko from HEAD, build and push an image tagged with the commit SHA,
# then keylessly sign it with cosign.
- name: Publish and sign konnector image
env:
KO_DOCKER_REPO: ghcr.io/${{ github.repository_owner }}/konnector
COSIGN_EXPERIMENTAL: 'true'
run: |
echo "${{ github.token }}" | ko login ghcr.io --username "${{ github.actor }}" --password-stdin
img=$(ko build --bare --platform=all -t latest -t ${{ github.sha }} -t ${{github.ref_name}} ./cmd/konnector)
echo "built ${img}"
cosign sign ${img} \
--yes \
-a sha=${{ github.sha }} \
-a ref=${{ github.ref }} \
-a run_id=${{ github.run_id }} \
-a run_attempt=${{ github.run_attempt }}
- name: Publish and sign example-backend image
env:
KO_DOCKER_REPO: ghcr.io/${{ github.repository_owner }}/example-backend
COSIGN_EXPERIMENTAL: 'true'
run: |
echo "${{ github.token }}" | ko login ghcr.io --username "${{ github.actor }}" --password-stdin
img=$(ko build --bare --platform=all -t latest -t ${{ github.sha }} -t ${{github.ref_name}} ./cmd/example-backend)
echo "built ${img}"
cosign sign ${img} \
--yes \
-a sha=${{ github.sha }} \
-a ref=${{ github.ref }} \
-a run_id=${{ github.run_id }} \
-a run_attempt=${{ github.run_attempt }}
- uses: actions/delete-package-versions@v3
with:
package-name: 'kube-bind'
min-versions-to-keep: 10
delete-only-pre-release-versions: "true"