diff --git a/.github/workflows/chart-preview.yml b/.github/workflows/chart-preview.yml index 5083456..3276a4c 100644 --- a/.github/workflows/chart-preview.yml +++ b/.github/workflows/chart-preview.yml @@ -30,23 +30,26 @@ jobs: sed -i "s/^version: .*/version: ${PREVIEW_VERSION}/" chart/Chart.yaml echo "PREVIEW_VERSION=${PREVIEW_VERSION}" >> $GITHUB_ENV + - name: Set registry owner + run: echo "REGISTRY_OWNER=$(echo '${{ github.repository_owner }}' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV + - name: Login to GHCR run: echo "${{ secrets.GITHUB_TOKEN }}" | helm registry login ghcr.io -u ${{ github.actor }} --password-stdin - name: Package and push run: | helm package ./chart - helm push theia-shared-cache-${PREVIEW_VERSION}.tgz oci://ghcr.io/${{ github.repository_owner }}/charts + helm push theia-shared-cache-${PREVIEW_VERSION}.tgz oci://ghcr.io/${{ env.REGISTRY_OWNER }}/charts - name: Comment install instructions uses: marocchino/sticky-pull-request-comment@v2 with: header: chart-preview message: | - ## 📦 Chart Preview Ready + ## Chart Preview Ready ```bash - helm install test oci://ghcr.io/${{ github.repository_owner }}/charts/theia-shared-cache --version ${{ env.PREVIEW_VERSION }} + helm install test oci://ghcr.io/${{ env.REGISTRY_OWNER }}/charts/theia-shared-cache --version ${{ env.PREVIEW_VERSION }} ``` _Updated: ${{ github.sha }}_ diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 54ea06c..e60c5e7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,6 +12,7 @@ jobs: release: permissions: contents: write + packages: write runs-on: ubuntu-latest steps: - name: Checkout @@ -19,20 +20,32 @@ jobs: with: fetch-depth: 0 - - name: Configure Git - run: | - git config user.name "$GITHUB_ACTOR" - git config user.email "$GITHUB_ACTOR@users.noreply.github.com" - - name: Install Helm uses: azure/setup-helm@v4 - name: Update chart dependencies run: helm dependency update ./chart - - name: Run chart-releaser - uses: helm/chart-releaser-action@v1.6.0 - env: - CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + - name: Set registry owner + run: echo "REGISTRY_OWNER=$(echo '${{ github.repository_owner }}' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV + + - name: Login to GHCR + run: echo "${{ secrets.GITHUB_TOKEN }}" | helm registry login ghcr.io -u ${{ github.actor }} --password-stdin + + - name: Extract chart version + id: chart + run: | + VERSION=$(grep '^version:' chart/Chart.yaml | awk '{print $2}') + echo "version=${VERSION}" >> $GITHUB_OUTPUT + + - name: Package and push to OCI + run: | + helm package ./chart + helm push theia-shared-cache-${{ steps.chart.outputs.version }}.tgz oci://ghcr.io/${{ env.REGISTRY_OWNER }}/charts + + - name: Create GitHub Release + uses: softprops/action-gh-release@v2 with: - charts_dir: "." + tag_name: theia-shared-cache-${{ steps.chart.outputs.version }} + name: theia-shared-cache ${{ steps.chart.outputs.version }} + generate_release_notes: true diff --git a/chart/templates/NOTES.txt b/chart/templates/NOTES.txt index 670ebfe..aaa49f7 100644 --- a/chart/templates/NOTES.txt +++ b/chart/templates/NOTES.txt @@ -21,21 +21,13 @@ Gradle Build Cache has been deployed! url = uri("$CACHE_URL/cache/") {{- if .Values.auth.enabled }} credentials { - username = "{{ .Values.auth.username }}" + username = "{{ .Values.auth.reader.username }}" password = "" } {{- end }} isPush = true } } - -5. MinIO console (for debugging): - - kubectl --namespace {{ .Release.Namespace }} port-forward svc/{{ .Release.Name }}-minio 9001:9001 - - Then open http://localhost:9001 - Username: minioadmin - Password: minioadmin {{- else }} Gradle Build Cache is disabled (enabled: false). No resources have been deployed. @@ -43,7 +35,7 @@ No resources have been deployed. {{- if .Values.reposilite.enabled }} -6. Reposilite (Maven/Gradle Dependency Proxy): +5. Reposilite (Maven/Gradle Dependency Proxy): Internal URL: http://{{ .Release.Name }}-reposilite:8080 @@ -57,10 +49,10 @@ No resources have been deployed. Maven repository URL (for Gradle): http://{{ .Release.Name }}-reposilite:8080/releases -7. Theia Pod Configuration: +6. Theia Pod Configuration: Set these environment variables in your Theia pods: GRADLE_CACHE_URL=http://{{ .Release.Name }}-cache:8080/cache/ GRADLE_REPO_URL=http://{{ .Release.Name }}-reposilite:8080/releases -{{- end }} \ No newline at end of file +{{- end }} diff --git a/chart/templates/deployment.yaml b/chart/templates/deployment.yaml index b5ee6bb..6a84588 100644 --- a/chart/templates/deployment.yaml +++ b/chart/templates/deployment.yaml @@ -19,7 +19,7 @@ spec: app.kubernetes.io/component: cache-server annotations: checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} - checksum/secret: {{ include (print $.Template.BasePath "/secrets.yaml") . | sha256sum }} + checksum/secret: {{ include (print $.Template.BasePath "/auth-secrets.yaml") . | sha256sum }} spec: initContainers: - name: wait-for-redis