Skip to content

Commit 2c924d9

Browse files
Merge pull request #10 from Gradiant/actions
Actions
2 parents 485f27a + 6d6882c commit 2c924d9

File tree

4 files changed

+163
-0
lines changed

4 files changed

+163
-0
lines changed

.github/workflows/lint-helm.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Lint Helm Chart
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
push:
8+
branches:
9+
- main
10+
11+
jobs:
12+
lint-helm:
13+
runs-on: ubuntu-latest
14+
env:
15+
CHART_PATH: charts/open5gs-operator
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
20+
- name: Install Helm
21+
uses: azure/setup-helm@v4
22+
with:
23+
version: v3.18.4
24+
25+
- name: Lint Helm chart
26+
run: helm lint $CHART_PATH
27+
28+
- name: Update Helm dependencies
29+
run: helm dep update $CHART_PATH

.github/workflows/publish.yml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: Build and Publish Docker Image & Helm Chart
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
build-and-publish:
13+
runs-on: ubuntu-latest
14+
env:
15+
IMAGE_NAME: gradiant/open5gs-operator
16+
CHART_PATH: charts/open5gs-operator
17+
CHART_REPO: oci://registry-1.docker.io/gradiantcharts
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v4
21+
22+
- name: Set up QEMU
23+
uses: docker/setup-qemu-action@v3
24+
25+
- name: Set up Docker Buildx
26+
uses: docker/setup-buildx-action@v3
27+
28+
- name: Log in to DockerHub
29+
uses: docker/login-action@v3
30+
with:
31+
username: ${{ secrets.DOCKERHUB_USERNAME }}
32+
password: ${{ secrets.DOCKERHUB_TOKEN }}
33+
34+
- name: Extract version from Makefile
35+
id: version
36+
run: |
37+
VERSION=$(grep -E '^VERSION[[:space:]]*\?=' Makefile | head -1 | sed 's/.*= *//')
38+
echo "version=$VERSION" >> $GITHUB_OUTPUT
39+
40+
- name: Build Docker image
41+
uses: docker/build-push-action@v5
42+
with:
43+
context: .
44+
push: false
45+
tags: ${{ env.IMAGE_NAME }}:latest,${{ env.IMAGE_NAME }}:${{ steps.version.outputs.version }}
46+
47+
- name: Push Docker image
48+
if: github.event_name == 'push'
49+
uses: docker/build-push-action@v5
50+
with:
51+
context: .
52+
push: true
53+
tags: ${{ env.IMAGE_NAME }}:latest,${{ env.IMAGE_NAME }}:${{ steps.version.outputs.version }}
54+
55+
- name: Set up Go
56+
uses: actions/setup-go@v5
57+
with:
58+
go-version-file: 'go.mod'
59+
60+
- name: Install Helm
61+
uses: azure/setup-helm@v4
62+
with:
63+
version: v3.18.4
64+
65+
- name: Lint Helm chart
66+
run: helm lint $CHART_PATH
67+
68+
- name: Update Helm dependencies
69+
run: helm dep update $CHART_PATH
70+
71+
- name: Generate Helm chart
72+
run: |
73+
make helm
74+
75+
- name: Package Helm chart
76+
run: |
77+
helm package $CHART_PATH --destination packaged-charts
78+
79+
- name: Helm registry login (DockerHub)
80+
if: github.event_name == 'push'
81+
run: |
82+
echo ${{ secrets.DOCKERHUB_TOKEN }} | helm registry login registry-1.docker.io -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
83+
84+
- name: Push Helm chart to DockerHub OCI registry
85+
if: github.event_name == 'push'
86+
run: |
87+
helm push packaged-charts/open5gs-operator-${{ steps.version.outputs.version }}.tgz $CHART_REPO
88+
89+
- name: Upload Helm chart as artifact
90+
uses: actions/upload-artifact@v4
91+
with:
92+
name: open5gs-operator-chart
93+
path: packaged-charts/*.tgz

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,3 +115,17 @@ A complete demo with UERANSIM is available at [this link](https://gradiant.githu
115115
10. **UPF Deployment Annotations:** The annotations for the UPF Deployment are managed exclusively through the `upf.deploymentAnnotations` field in the CR. Any annotation not present in this field will be automatically reconciled by the operator (added or removed as needed), so manual changes to annotations will not persist unless reflected in the CR.
116116
11. **UPF GTP-U Interface:** The GTP-U network interface used by the UPF is set via the `upf.gtpuDev` field in the CR (e.g., `gtpuDev: "eth0"`). By default, the UPF uses the `eth0` interface.
117117

118+
## How to create a new release
119+
120+
To publish a new version of the operator, follow these steps:
121+
122+
1. Make the necessary changes in the code.
123+
2. Run the version script:
124+
```bash
125+
./set-version.sh <new_version>
126+
```
127+
This will update the version in all relevant files (Makefile, kustomization.yaml, Chart.yaml, and values.yaml).
128+
3. Commit the changes and create the corresponding Pull Request (PR).
129+
130+
This ensures that the published version is consistent with the code and manifests.
131+

set-version.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/bash
2+
# Script to update the version in Makefile, kustomization.yaml, Chart.yaml, and values.yaml
3+
# Usage: ./set-version.sh <new_version>
4+
5+
set -e
6+
7+
if [ -z "$1" ]; then
8+
echo "Usage: $0 <new_version>"
9+
exit 1
10+
fi
11+
12+
NEW_VERSION="$1"
13+
14+
# Update Makefile
15+
sed -i "s/^VERSION ?=.*/VERSION ?= $NEW_VERSION/" Makefile
16+
17+
# Update kustomization.yaml
18+
sed -i "s/newTag: .*/newTag: $NEW_VERSION/" config/manager/kustomization.yaml
19+
20+
# Update Chart.yaml
21+
sed -i "s/^version: .*/version: $NEW_VERSION/" charts/open5gs-operator/Chart.yaml
22+
sed -i "s/^appVersion: .*/appVersion: \"$NEW_VERSION\"/" charts/open5gs-operator/Chart.yaml
23+
24+
# Update values.yaml (regardless of indentation)
25+
sed -i "s/^\s*tag: .*/ tag: $NEW_VERSION/" charts/open5gs-operator/values.yaml
26+
27+
echo "Versions updated to $NEW_VERSION!"

0 commit comments

Comments
 (0)