name: release-charts-postgres-cluster on: push: branches: - main paths: - "charts/postgres-cluster/**" workflow_dispatch: env: WORKFLOW_DIR: "charts/postgres-cluster" jobs: release: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Set up Helm uses: azure/setup-helm@v4 with: token: ${{ secrets.GITEA_TOKEN }} version: latest - name: Package Helm Chart run: | cd $WORKFLOW_DIR helm dependency build echo "PACKAGE_PATH=$(helm package . | awk '{print $NF}')" >> $GITEA_ENV - name: Publish Helm Chart to Harbor run: | helm registry login ${{ vars.REGISTRY_HOST }} -u ${{ vars.REGISTRY_USER }} -p ${{ secrets.REGISTRY_SECRET }} helm push ${{ env.PACKAGE_PATH }} oci://${{ vars.REGISTRY_HOST }}/helm-charts - name: Publish Helm Chart to Gitea run: | helm plugin install https://github.com/chartmuseum/helm-push helm repo add --username ${{ gitea.actor }} --password ${{ secrets.REPOSITORY_TOKEN }} helm-charts https://${{ vars.REPOSITORY_HOST }}/api/packages/alexlebens/helm helm cm-push ${{ env.PACKAGE_PATH }} helm-charts - name: Extract Chart Metadata run: | cd $WORKFLOW_DIR echo "CHART_VERSION=$(yq '.version' Chart.yaml)" >> $GITEA_ENV echo "CHART_NAME=$(yq '.name' Chart.yaml)" >> $GITEA_ENV - name: Release Helm Chart uses: akkuman/gitea-release-action@v1 with: name: ${{ env.CHART_NAME }}-${{ env.CHART_VERSION }} tag_name: ${{ env.CHART_NAME }}-${{ env.CHART_VERSION }} files: |- ${{ env.PACKAGE_PATH }} - name: ntfy Success uses: niniyas/ntfy-action@master if: success() with: url: '${{ secrets.NTFY_URL }}' topic: '${{ secrets.NTFY_TOPIC }}' title: 'Gitea Action' priority: 3 headers: '{"Authorization": "Bearer ${{ secrets.NTFY_CRED }}"}' tags: action,successfully,completed details: 'Helm Chart for postgres-cluster release workflow has successfully completed!' icon: 'https://cdn.jsdelivr.net/gh/selfhst/icons/png/gitea.png' - name: ntfy Failed uses: niniyas/ntfy-action@master if: failure() with: url: '${{ secrets.NTFY_URL }}' topic: '${{ secrets.NTFY_TOPIC }}' title: 'Gitea Action' priority: 4 headers: '{"Authorization": "Bearer ${{ secrets.NTFY_CRED }}"}' tags: action,failed details: 'Helm Chart for postgres-cluster release workflow has failed!' icon: 'https://cdn.jsdelivr.net/gh/selfhst/icons/png/gitea.png' actions: '[{"action": "view", "label": "Open Gitea", "url": "https://gitea.alexlebens.dev/alexlebens/site-profile/actions?workflow=release-image.yml", "clear": true}]' image: true