-
Notifications
You must be signed in to change notification settings - Fork 1
219 lines (197 loc) · 7.33 KB
/
publish-release.yaml
File metadata and controls
219 lines (197 loc) · 7.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
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
# Copyright The Linux Foundation and each contributor to LFX.
# SPDX-License-Identifier: MIT
---
name: Publish Release
"on":
push:
tags:
- v*
env:
COSIGN_VERSION: v3.0.2
HELM_VERSION: 4.0.4
DOCKER_REGISTRY: ghcr.io/linuxfoundation/lfx-v1-sync-helper
permissions:
contents: read
jobs:
publish-v1-sync-helper:
name: Publish v1-sync-helper Tagged Release
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
outputs:
app_version: ${{ steps.prepare.outputs.app_version }}
chart_name: ${{ steps.prepare.outputs.chart_name }}
chart_version: ${{ steps.prepare.outputs.chart_version }}
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Prepare versions and chart name
id: prepare
run: |
set -euo pipefail
APP_VERSION=$(echo ${{ github.ref_name }} | sed 's/v//g')
CHART_NAME="$(yq '.name' charts/*/Chart.yaml)"
CHART_VERSION=$(echo ${{ github.ref_name }} | sed 's/v//g')
{
echo "app_version=$APP_VERSION"
echo "chart_name=$CHART_NAME"
echo "chart_version=$CHART_VERSION"
} >> "$GITHUB_OUTPUT"
- name: Setup Go
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
with:
go-version-file: go.mod
- name: Setup Ko
uses: ko-build/setup-ko@d006021bd0c28d1ce33a07e7943d48b079944c8d # v0.9
with:
version: v0.18.0
- name: Build and publish container image
run: |
ko build github.com/linuxfoundation/lfx-v1-sync-helper/cmd/lfx-v1-sync-helper \
-B \
--platform linux/amd64,linux/arm64 \
-t ${{ github.ref_name }} \
-t ${{ steps.prepare.outputs.app_version }} \
-t latest \
--sbom spdx
publish-meltano:
name: Publish Meltano Tagged Release
runs-on: ubuntu-latest
needs: [publish-v1-sync-helper]
permissions:
contents: read
packages: write
id-token: write
outputs:
image_name: ${{ steps.build.outputs.image_name }}
digest: ${{ steps.build.outputs.digest }}
app_version: ${{ steps.prepare.outputs.app_version }}
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Prepare versions
id: prepare
run: |
set -euo pipefail
APP_VERSION=$(echo ${{ github.ref_name }} | sed 's/v//g')
echo "app_version=$APP_VERSION" >> "$GITHUB_OUTPUT"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
- name: Login to GitHub Container Registry
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5.10.0
with:
images: ${{ env.DOCKER_REGISTRY }}/meltano
tags: |
type=ref,event=tag
type=semver,pattern={{version}}
type=raw,value=latest
- name: Build and push Meltano Docker image
id: build
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
with:
context: .
file: docker/Dockerfile.meltano
platforms: linux/amd64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
provenance: mode=max
sbom: true
- name: Install Cosign
uses: sigstore/cosign-installer@faadad0cce49287aee09b3a48701e75088a2c6ad # v4.0.0
with:
cosign-release: "${{ env.COSIGN_VERSION }}"
- name: Sign the Meltano container image
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -euo pipefail
cosign sign --yes '${{ env.DOCKER_REGISTRY }}/meltano@${{ steps.build.outputs.digest }}'
release-helm-chart:
needs:
- publish-v1-sync-helper
- publish-meltano
runs-on: ubuntu-24.04
permissions:
contents: write
packages: write
id-token: write
outputs:
digest: ${{ steps.publish-ghcr.outputs.digest }}
image_name: ${{ steps.publish-ghcr.outputs.image_name }}
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Publish Chart to GHCR
id: publish-ghcr
uses: >- # main
linuxfoundation/lfx-public-workflows/.github/actions/helm-chart-oci-publisher@c465d6571fa0b8be9d551d902955164ea04a00af
with:
name: ${{ needs.publish-v1-sync-helper.outputs.chart_name }}
repository: ${{ github.repository }}/chart
chart_version: ${{ needs.publish-v1-sync-helper.outputs.chart_version }}
app_version: ${{ needs.publish-v1-sync-helper.outputs.app_version }}
helm_version: "${{ env.HELM_VERSION }}"
registry: ghcr.io
registry_username: ${{ github.actor }}
registry_password: ${{ secrets.GITHUB_TOKEN }}
- name: Install Cosign
uses: sigstore/cosign-installer@faadad0cce49287aee09b3a48701e75088a2c6ad # v4.0.0
with:
cosign-release: "${{ env.COSIGN_VERSION }}"
- name: Login to GitHub
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Sign the Helm chart in GHCR
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -euo pipefail
cosign sign --yes '${{ steps.publish-ghcr.outputs.image_name }}@${{ steps.publish-ghcr.outputs.digest }}'
create-ghcr-helm-provenance:
needs:
- release-helm-chart
permissions:
actions: read
id-token: write
packages: write
# Note, this action *cannot* be pinned to a ref: see the project's
# explanation at "Referencing SLSA builders and generators" in their
# README.
uses: slsa-framework/slsa-github-generator/.github/workflows/generator_container_slsa3.yml@v2.1.0
with:
image: ${{ needs.release-helm-chart.outputs.image_name }}
digest: ${{ needs.release-helm-chart.outputs.digest }}
registry-username: ${{ github.actor }}
secrets:
registry-password: ${{ secrets.GITHUB_TOKEN }}
create-meltano-provenance:
needs:
- publish-meltano
permissions:
actions: read
id-token: write
packages: write
# Note, this action *cannot* be pinned to a ref: see the project's
# explanation at "Referencing SLSA builders and generators" in their
# README.
uses: slsa-framework/slsa-github-generator/.github/workflows/generator_container_slsa3.yml@v2.1.0
with:
image: ${{ needs.publish-meltano.outputs.image_name }}
digest: ${{ needs.publish-meltano.outputs.digest }}
registry-username: ${{ github.actor }}
secrets:
registry-password: ${{ secrets.GITHUB_TOKEN }}