-
Notifications
You must be signed in to change notification settings - Fork 0
181 lines (151 loc) · 6.16 KB
/
Copy pathrelease.yml
File metadata and controls
181 lines (151 loc) · 6.16 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
name: Release
on:
push:
branches: ["main"]
tags: ["v*"]
workflow_dispatch:
permissions:
contents: read
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
attestations: write
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@37fe631027851001ddb9b187196cc803df7f5f0e # v4.3.0
- name: Log in to GitHub Container Registry
uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 # v6.2.0
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha,prefix=sha-
type=raw,value=latest,enable={{is_default_branch}}
- name: Build and push Docker image
id: build
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha,scope=cainjekt
cache-to: type=gha,mode=max,scope=cainjekt
platforms: linux/amd64,linux/arm64
- name: Generate artifact attestation
if: github.event.repository.visibility == 'public'
uses: actions/attest-build-provenance@4d101475d8b20a2381f78447822ac1eab6504dd8 # v4.2.2
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
subject-digest: ${{ steps.build.outputs.digest }}
push-to-registry: true
- name: Extract metadata for installer
id: meta-installer
uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 # v6.2.0
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-installer
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha,prefix=sha-
type=raw,value=latest,enable={{is_default_branch}}
- name: Build and push installer image
id: build-installer
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0
with:
context: .
target: installer
push: true
tags: ${{ steps.meta-installer.outputs.tags }}
labels: ${{ steps.meta-installer.outputs.labels }}
cache-from: |
type=gha,scope=cainjekt-installer
type=gha,scope=cainjekt
platforms: linux/amd64,linux/arm64
- name: Generate installer artifact attestation
if: github.event.repository.visibility == 'public'
uses: actions/attest-build-provenance@4d101475d8b20a2381f78447822ac1eab6504dd8 # v4.2.2
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-installer
subject-digest: ${{ steps.build-installer.outputs.digest }}
push-to-registry: true
helm-publish:
runs-on: ubuntu-latest
needs: build-and-push
if: startsWith(github.ref, 'refs/tags/v')
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Extract version from tag
id: version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: Log in to GitHub Container Registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | helm registry login ${{ env.REGISTRY }} --username ${{ github.actor }} --password-stdin
- name: Update Chart.yaml version
run: |
sed -i "s/^version:.*/version: ${{ steps.version.outputs.VERSION }}/" charts/cainjekt/Chart.yaml
sed -i "s/^appVersion:.*/appVersion: \"${{ steps.version.outputs.VERSION }}\"/" charts/cainjekt/Chart.yaml
- name: Package and push Helm chart
run: |
helm package charts/cainjekt
helm push cainjekt-${{ steps.version.outputs.VERSION }}.tgz oci://${{ env.REGISTRY }}/natrontech/charts
release:
runs-on: ubuntu-latest
needs: [build-and-push, helm-publish]
if: startsWith(github.ref, 'refs/tags/v')
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Extract version from tag
id: version
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Create Release
uses: softprops/action-gh-release@3d0d9888cb7fd7b750713d6e236d1fcb99157228 # v3.0.2
with:
prerelease: ${{ contains(steps.version.outputs.VERSION, '-') }}
body: |
## Container Images
```
ghcr.io/natrontech/cainjekt:${{ steps.version.outputs.VERSION }}
ghcr.io/natrontech/cainjekt-installer:${{ steps.version.outputs.VERSION }}
```
Both `linux/amd64` and `linux/arm64` platforms are supported.
## Install with Helm
```bash
helm install cainjekt oci://ghcr.io/natrontech/charts/cainjekt \
--version ${{ steps.version.outputs.VERSION }} \
--namespace kube-system \
--set-file caBundle=/path/to/ca-bundle.pem
```
## Install with kubectl
```bash
kubectl create configmap cainjekt-ca-bundle \
--from-file=ca-bundle.pem=/path/to/ca-bundle.pem \
--namespace=kube-system
kubectl apply -k https://github.com/natrontech/cainjekt/deploy/kubernetes?ref=${{ steps.version.outputs.VERSION }}
```
generate_release_notes: true