Skip to content

OCI chart release #256

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Mar 20, 2025
23 changes: 13 additions & 10 deletions .github/workflows/lint-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,42 +8,45 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. This makes me realize I need dependabot enabled on this repo.

with:
fetch-depth: 0

- name: Set up Helm
uses: azure/setup-helm@v1
uses: azure/setup-helm@v4
with:
version: v3.4.0
version: v3.17.2

- uses: actions/setup-python@v2
- uses: actions/setup-python@v5
with:
python-version: 3.13

- name: Set up chart-testing
uses: helm/chart-testing-action@v2.0.1
uses: helm/chart-testing-action@v2.7.0

- name: Run chart-testing (list-changed)
id: list-changed
run: |
changed=$(ct list-changed)
changed=$(ct list-changed --target-branch ${{ github.event.repository.default_branch }})
if [[ -n "$changed" ]]; then
echo "changed=true" >> $GITHUB_OUTPUT
echo "changed=true" >> "$GITHUB_OUTPUT"
fi

- name: Run chart-testing (lint)
run: ct lint
if: steps.list-changed.outputs.changed == 'true'
run: ct lint --target-branch ${{ github.event.repository.default_branch }}

- name: Create kind cluster
uses: helm/[email protected]
if: steps.list-changed.outputs.changed == 'true'
uses: helm/[email protected]

- name: Install LoadBalancer
if: steps.list-changed.outputs.changed == 'true'
run: |-
kubectl config use-context kind-chart-testing
kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.13.10/config/manifests/metallb-native.yaml
kubectl apply -f .github/metallb-configmap.yaml

- name: Run chart-testing (install)
run: ct install
if: steps.list-changed.outputs.changed == 'true'
run: ct install --target-branch ${{ github.event.repository.default_branch }}
41 changes: 29 additions & 12 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

name: Release Charts

on:
Expand All @@ -10,12 +9,15 @@ jobs:
release:
timeout-minutes: 5
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Turnstyle
uses: softprops/turnstyle@v1
uses: softprops/turnstyle@v2
with:
continue-after-seconds: 180
env:
Expand All @@ -28,19 +30,34 @@ jobs:
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
# See https://github.com/helm/chart-releaser-action/issues/6

- name: Install Helm
run: |
curl -fsSLo get_helm.sh https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3
chmod 700 get_helm.sh
./get_helm.sh
uses: azure/setup-helm@v4

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Add dependency chart repos
run: |
helm repo add stable https://charts.helm.sh/stable
helm repo update stable

- name: Run chart-releaser
uses: helm/[email protected]
with:
charts_repo_url: https://itzg.github.io/minecraft-server-charts
uses: helm/[email protected]
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"


## https://github.com/helm/chart-releaser-action/issues/107#issuecomment-2133797963
- name: Push Charts to GHCR
run: |
for pkg in .cr-release-packages/*; do
if [ -z "${pkg:-}" ]; then
break
fi

helm push "${pkg}" oci://ghcr.io/${{ github.repository }}
done
2 changes: 1 addition & 1 deletion charts/minecraft-proxy/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v1
name: minecraft-proxy
version: 3.8.4
version: 3.9.0
appVersion: SeeValues
description: Minecraft proxy server (BungeeCord, Waterfall, Velocity, etc.)
keywords:
Expand Down
2 changes: 1 addition & 1 deletion charts/minecraft-proxy/templates/extraports-ing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ metadata:
{{- end }}
labels:
app: {{ $serviceName }}
chart: "{{ $.Chart.Name }}-{{ $.Chart.Version }}"
chart: {{ template "minecraft.fullname" . }}
release: "{{ $.Release.Name }}"
heritage: "{{ $.Release.Service }}"
spec:
Expand Down
2 changes: 1 addition & 1 deletion charts/minecraft-proxy/templates/extraports-svc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ metadata:
annotations: {{ toYaml .service.annotations | nindent 4 }}
labels:
app: {{ $serviceName }}
chart: "{{ $.Chart.Name }}-{{ $.Chart.Version }}"
chart: {{ template "minecraft.fullname" . }}
release: "{{ $.Release.Name }}"
heritage: "{{ $.Release.Service }}"
spec:
Expand Down
2 changes: 1 addition & 1 deletion charts/minecraft/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v1
name: minecraft
version: 4.25.1
version: 4.26.0
appVersion: SeeValues
home: https://minecraft.net/
description: Minecraft server
Expand Down
9 changes: 9 additions & 0 deletions charts/minecraft/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@ We change "+" with "_" for OCI compatibility
{{- printf "%s-%s" .Chart.Name (.Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-") -}}
{{- end }}

{{/*
Set the chart version
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the labels spec).
We change "+" with "_" for OCI compatibility
*/}}
{{- define "chart.version" -}}
{{- default .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end }}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
Expand Down
4 changes: 2 additions & 2 deletions charts/minecraft/templates/backupdir-pvc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ metadata:
namespace: {{ .Release.Namespace }}
labels:
app: {{ template "minecraft.fullname" . }}
chart: "{{ include "chart.fullname" . }}"
chart: {{ template "chart.fullname" . }}
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
app.kubernetes.io/name: "{{ .Chart.Name }}"
app.kubernetes.io/instance: {{ template "minecraft.fullname" . }}
app.kubernetes.io/version: "{{ .Chart.Version }}"
app.kubernetes.io/version: {{ template "chart.version" . }}
annotations:
{{- with .Values.mcbackup.persistence.annotations }}
{{ toYaml . | nindent 4 }}
Expand Down
4 changes: 2 additions & 2 deletions charts/minecraft/templates/datadir-pvc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ metadata:
namespace: {{ .Release.Namespace }}
labels:
app: {{ template "minecraft.fullname" . }}
chart: "{{ include "chart.fullname" . }}"
chart: {{ template "chart.fullname" . }}
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
app.kubernetes.io/name: "{{ .Chart.Name }}"
app.kubernetes.io/instance: {{ template "minecraft.fullname" . }}
app.kubernetes.io/version: "{{ .Chart.Version }}"
app.kubernetes.io/version: {{ template "chart.version" . }}
{{- with .Values.persistence.labels }}
{{ toYaml . | nindent 4 }}
{{- end }}
Expand Down
14 changes: 7 additions & 7 deletions charts/minecraft/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ metadata:
{{- end }}
labels:
app: {{ template "minecraft.fullname" . }}
chart: "{{ include "chart.fullname" . }}"
chart: {{ template "chart.fullname" . }}
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
app.kubernetes.io/name: "{{ .Chart.Name }}"
app.kubernetes.io/instance: {{ template "minecraft.fullname" . }}
app.kubernetes.io/version: "{{ .Chart.Version }}"
app.kubernetes.io/version: {{ template "chart.version" . }}
{{- if .Values.deploymentLabels }}
{{- range $key, $value := .Values.deploymentLabels}}
{{ $key }}: {{ $value | quote }}
Expand All @@ -42,7 +42,7 @@ spec:
app: {{ template "minecraft.fullname" . }}
app.kubernetes.io/name: "{{ .Chart.Name }}"
app.kubernetes.io/instance: {{ template "minecraft.fullname" . }}
app.kubernetes.io/version: "{{ .Chart.Version }}"
app.kubernetes.io/version: {{ template "chart.version" . }}
{{- if .Values.podLabels }}
{{- range $key, $value := .Values.podLabels}}
{{ $key }}: {{ $value | quote }}
Expand Down Expand Up @@ -531,12 +531,12 @@ spec:
name: datadir
labels:
app: {{ template "minecraft.fullname" . }}
chart: "{{ include "chart.fullname" . }}"
chart: {{ template "chart.fullname" . }}
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
app.kubernetes.io/name: "{{ .Chart.Name }}"
app.kubernetes.io/instance: {{ template "minecraft.fullname" . }}
app.kubernetes.io/version: "{{ .Chart.Version }}"
app.kubernetes.io/version: {{ template "chart.version" . }}
annotations:
{{- with .Values.persistence.annotations }}
{{ toYaml . | nindent 10 }}
Expand Down Expand Up @@ -565,12 +565,12 @@ spec:
name: backupdir
labels:
app: {{ template "minecraft.fullname" . }}
chart: "{{ include "chart.fullname" . }}"
chart: {{ template "chart.fullname" . }}
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
app.kubernetes.io/name: "{{ .Chart.Name }}"
app.kubernetes.io/instance: {{ template "minecraft.fullname" . }}
app.kubernetes.io/version: "{{ .Chart.Version }}"
app.kubernetes.io/version: {{ template "chart.version" . }}
annotations:
{{- with .Values.mcbackup.persistence.annotations }}
{{ toYaml . | nindent 10 }}
Expand Down
4 changes: 2 additions & 2 deletions charts/minecraft/templates/extraports-ing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ metadata:
{{- end }}
labels:
app: {{ $serviceName }}
chart: "{{ $.Chart.Name }}-{{ $.Chart.Version }}"
chart: {{ template "minecraft.fullname" . }}
release: "{{ $.Release.Name }}"
heritage: "{{ $.Release.Service }}"
app.kubernetes.io/name: "{{ $.Chart.Name }}"
app.kubernetes.io/instance: {{ $minecraftFullname }}
app.kubernetes.io/version: "{{ $.Chart.Version }}"
app.kubernetes.io/version: {{ template "chart.version" . }}
spec:
{{- if .ingress.ingressClassName }}
ingressClassName: {{ .ingress.ingressClassName }}
Expand Down
4 changes: 2 additions & 2 deletions charts/minecraft/templates/extraports-svc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ metadata:
annotations: {{ toYaml .service.annotations | nindent 4 }}
labels:
app: {{ $serviceName }}
chart: "{{ $.Chart.Name }}-{{ $.Chart.Version }}"
chart: {{ template "minecraft.fullname" . }}
release: "{{ $.Release.Name }}"
heritage: "{{ $.Release.Service }}"
app.kubernetes.io/name: "{{ $.Chart.Name }}"
app.kubernetes.io/instance: {{ $minecraftFullname }}
app.kubernetes.io/version: "{{ $.Chart.Version }}"
app.kubernetes.io/version: {{ template "chart.version" . }}
spec:
{{- if (or (eq .service.type "ClusterIP") (empty .service.type)) }}
type: ClusterIP
Expand Down
4 changes: 2 additions & 2 deletions charts/minecraft/templates/minecraft-svc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ metadata:
namespace: {{ .Release.Namespace }}
labels:
app: {{ template "minecraft.fullname" . }}
chart: "{{ include "chart.fullname" . }}"
chart: {{ template "chart.fullname" . }}
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
app.kubernetes.io/name: "{{ .Chart.Name }}"
app.kubernetes.io/instance: {{ template "minecraft.fullname" . }}
app.kubernetes.io/version: "{{ .Chart.Version }}"
app.kubernetes.io/version: {{ template "chart.version" . }}
{{- if .Values.serviceLabels }}
{{- range $key, $value := .Values.serviceLabels}}
{{ $key }}: {{ $value | quote }}
Expand Down
4 changes: 2 additions & 2 deletions charts/minecraft/templates/rclone-secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ metadata:
name: {{ template "minecraft.fullname" . }}-rclone-config
labels:
app: {{ template "minecraft.fullname" . }}
chart: "{{ include "chart.fullname" . }}"
chart: {{ template "chart.fullname" . }}
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
app.kubernetes.io/name: "{{ .Chart.Name }}"
app.kubernetes.io/instance: {{ template "minecraft.fullname" . }}
app.kubernetes.io/version: "{{ .Chart.Version }}"
app.kubernetes.io/version: {{ template "chart.version" . }}
type: Opaque
data:
rclone.conf: |-
Expand Down
4 changes: 2 additions & 2 deletions charts/minecraft/templates/rcon-svc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ metadata:
{{ toYaml .Values.rconServiceAnnotations | indent 4 }}
labels:
app: {{ template "minecraft.fullname" . }}
chart: "{{ include "chart.fullname" . }}"
chart: {{ template "chart.fullname" . }}
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
app.kubernetes.io/name: "{{ .Chart.Name }}"
app.kubernetes.io/instance: {{ template "minecraft.fullname" . }}
app.kubernetes.io/version: "{{ .Chart.Version }}"
app.kubernetes.io/version: {{ template "chart.version" . }}
{{- if .Values.rconServiceLabels }}
{{- range $key, $value := .Values.rconServiceLabels}}
{{ $key }}: {{ $value | quote }}
Expand Down
8 changes: 4 additions & 4 deletions charts/minecraft/templates/secrets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ metadata:
namespace: {{ .Release.Namespace }}
labels:
app: {{ template "minecraft.fullname" . }}
chart: "{{ include "chart.fullname" . }}"
chart: {{ template "chart.fullname" . }}
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
app.kubernetes.io/name: "{{ .Chart.Name }}"
app.kubernetes.io/instance: {{ template "minecraft.fullname" . }}
app.kubernetes.io/version: "{{ .Chart.Version }}"
app.kubernetes.io/version: {{ template "chart.version" . }}
type: Opaque
data:
rcon-password: {{ default "" .Values.minecraftServer.rcon.password | b64enc | quote }}
Expand All @@ -26,12 +26,12 @@ metadata:
namespace: {{ .Release.Namespace }}
labels:
app: {{ template "minecraft.fullname" . }}
chart: "{{ include "chart.fullname" . }}"
chart: {{ template "chart.fullname" . }}
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
app.kubernetes.io/name: "{{ .Chart.Name }}"
app.kubernetes.io/instance: {{ template "minecraft.fullname" . }}
app.kubernetes.io/version: "{{ .Chart.Version }}"
app.kubernetes.io/version: {{ template "chart.version" . }}
type: Opaque
data:
cf-api-key: {{ default "" .Values.minecraftServer.autoCurseForge.apiKey.key | b64enc | quote }}
Expand Down