forked from rancher/turtles
-
Notifications
You must be signed in to change notification settings - Fork 0
119 lines (115 loc) · 3.66 KB
/
release.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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
name: release
on:
workflow_dispatch:
env:
TAG: ${{ github.ref_name }}
REGISTRY: ghcr.io
USERNAME: ${{ github.actor }}
PASSWORD: ${{ secrets.GITHUB_TOKEN }}
ORG: alexander-demicev
PROD_ORG: alexander-demicev
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
RELEASE_DIR: .cr-release-packages
REPO: ${{ github.repository }}
permissions:
contents: write # Allow to create a release.
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
outputs:
multiarch_image: ${{ steps.ghcr-images.outputs.multiarch }}
amd64_image: ${{ steps.ghcr-images.outputs.amd64 }}
armd64_image: ${{ steps.ghcr-images.outputs.arm64 }}
s390x_image: ${{ steps.ghcr-images.outputs.s390x }}
multiarch_digest: ${{ steps.ghcr-images.outputs.multiarch_digest }}
arm64_digest: ${{ steps.ghcr-images.outputs.arm64_digest }}
amd64_digest: ${{ steps.ghcr-images.outputs.amd64_digest }}
s390x_digest: ${{ steps.ghcr-images.outputs.s390x_digest }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: setupGo
uses: actions/setup-go@v4
with:
go-version: '=1.20.7'
- name: Docker login to ghcr registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ env.USERNAME }}
password: ${{ env.PASSWORD }}
- name: Build docker image for gh registry
run: make docker-build-all TAG=${{ env.TAG }} REGISTRY=${{ env.REGISTRY }}
- name: Push docker image to gh registry
run: make docker-push-all TAG=${{ env.TAG }} REGISTRY=${{ env.REGISTRY }}
- name: Store list of ghcr images
id: ghcr-images
run: |
./scripts/image-digest.sh ${{ env.REGISTRY }} ${{ env.PROD_ORG }} ${{ env.TAG }}
ghcr-sign:
runs-on: ubuntu-latest
needs: [build]
strategy:
matrix:
images: [
{
"image":"${{ needs.build.outputs.multiarch_image }}",
},
{
"image":"${{ needs.build.outputs.amd64_image }}",
},
{
"image":"${{ needs.build.outputs.amd64_image }}",
},
{
"image":"${{ needs.build.outputs.s390x_image }}",
}
]
steps:
- uses: sigstore/[email protected]
- name: Sign manifests
env:
COSIGN_EXPERIMENTAL: 1
run: |
echo ${{ matrix.images }}
echo ${{ matrix.images.image }}
cosign sign --yes ${{ matrix.images.image }}
ghcr-provenance:
needs: [build, ghcr-sign]
permissions:
actions: read
id-token: write
packages: write
strategy:
matrix:
images: [
{
"image":"${{ needs.build.outputs.multiarch_image }}",
"digest":"${{ needs.build.outputs.multiarch_digest }}"
},
{
"image":"${{ needs.build.outputs.amd64_image }}",
"digest":"${{ needs.build.outputs.amd64_digest }}"
},
{
"image":"${{ needs.build.outputs.amd64_image }}",
"digest":"${{ needs.build.outputs.arm64_digest }}"
},
{
"image":"${{ needs.build.outputs.s390x_image }}",
"digest":"${{ needs.build.outputs.s390x_digest }}"
}
]
uses: slsa-framework/slsa-github-generator/.github/workflows/[email protected]
with:
image: ${{ matrix.images.image }}
digest: ${{ matrix.images.digest }}
secrets:
registry-username: ${{ github.actor }}
registry-password: ${{ secrets.GITHUB_TOKEN }}