-
Notifications
You must be signed in to change notification settings - Fork 0
206 lines (168 loc) · 5.95 KB
/
Copy pathrelease.yml
File metadata and controls
206 lines (168 loc) · 5.95 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
name: Release
on:
push:
tags:
- 'v*.*.*'
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-and-push-image:
name: Build and Push Container Image
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
outputs:
version: ${{ steps.meta.outputs.version }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
type=raw,value=latest,enable={{is_default_branch}}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
release-helm-chart:
name: Release Helm Chart
runs-on: ubuntu-latest
needs: build-and-push-image
permissions:
contents: write
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.24'
cache: true
- name: Setup Helm
uses: azure/setup-helm@v4
with:
version: 'v3.14.0'
- name: Extract version from tag
id: version
run: |
VERSION=${GITHUB_REF#refs/tags/v}
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "Version: ${VERSION}"
- name: Update Chart.yaml with version
run: |
VERSION=${{ steps.version.outputs.version }}
sed -i "s/^version:.*/version: ${VERSION}/" chart/openawareness-controller/Chart.yaml
sed -i "s/^appVersion:.*/appVersion: \"${VERSION}\"/" chart/openawareness-controller/Chart.yaml
cat chart/openawareness-controller/Chart.yaml
- name: Generate Helm chart
run: make helm
- name: Lint Helm chart
run: make helm-lint
- name: Package Helm chart
run: make helm-package
- name: Generate install manifests
run: make build-installer
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push Helm chart to OCI registry
run: |
CHART_VERSION=${{ steps.version.outputs.version }}
helm push dist/openawareness-controller-${CHART_VERSION}.tgz oci://${{ env.REGISTRY }}/syndlex/charts
- name: Configure Git for chart-releaser
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
- name: Run chart-releaser
uses: helm/chart-releaser-action@v1.6.0
with:
charts_dir: chart
skip_existing: true
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
CR_SKIP_EXISTING: true
- name: Generate changelog
uses: orhun/git-cliff-action@v4
id: git-cliff
with:
config: cliff.toml
args: --verbose --latest --strip header
env:
OUTPUT: CHANGELOG_BODY.md
GITHUB_REPO: ${{ github.repository }}
- name: Generate release notes
id: release_notes
run: |
VERSION=${{ steps.version.outputs.version }}
cat > release_notes.md <<EOF
## OpenAwareness Controller ${VERSION}
### What's Changed
EOF
# Append the generated changelog
if [ -f CHANGELOG_BODY.md ]; then
cat CHANGELOG_BODY.md >> release_notes.md
echo "" >> release_notes.md
fi
cat >> release_notes.md <<EOF
### Container Images
- \`ghcr.io/syndlex/openawareness-operator:${VERSION}\`
- \`ghcr.io/syndlex/openawareness-operator:latest\`
**Multi-architecture support:** linux/amd64, linux/arm64
### Helm Chart Installation
Install from OCI Registry:
\`\`\`bash
helm install openawareness oci://ghcr.io/syndlex/charts/openawareness-controller \
--version ${VERSION} \
--namespace openawareness-system \
--create-namespace
\`\`\`
### Kubectl Installation
\`\`\`bash
kubectl apply -f https://github.com/Syndlex/Openawareness-Operator/releases/download/v${VERSION}/install.yaml
\`\`\`
### Documentation
- [Helm Chart README](https://github.com/Syndlex/Openawareness-Operator/tree/main/chart/openawareness-controller)
- [Project README](https://github.com/Syndlex/Openawareness-Operator/blob/main/README.md)
EOF
cat release_notes.md
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
body_path: release_notes.md
files: |
dist/openawareness-controller-*.tgz
dist/install.yaml
draft: false
prerelease: false
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}