chore(main): release 0.1.2 (#68) #23
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release Please | |
| on: | |
| push: | |
| branches: | |
| - main | |
| permissions: | |
| contents: write | |
| packages: write | |
| pull-requests: write | |
| concurrency: | |
| group: release-please-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| GHCR_IMAGE: ghcr.io/${{ github.repository }} | |
| jobs: | |
| release-please: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| release_created: ${{ steps.release.outputs.release_created }} | |
| tag_name: ${{ steps.release.outputs.tag_name }} | |
| steps: | |
| - name: Release Please | |
| id: release | |
| uses: googleapis/release-please-action@v4 | |
| with: | |
| config-file: .github/release-please-config.json | |
| manifest-file: .github/.release-please-manifest.json | |
| # Build and push Docker images when release is created | |
| - name: Checkout code | |
| if: ${{ steps.release.outputs.release_created }} | |
| uses: actions/checkout@v6 | |
| - name: Set up Docker Buildx | |
| if: ${{ steps.release.outputs.release_created }} | |
| uses: docker/setup-buildx-action@v4 | |
| - name: Log in to GitHub Container Registry | |
| if: ${{ steps.release.outputs.release_created }} | |
| uses: docker/login-action@v4 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract Docker metadata | |
| if: ${{ steps.release.outputs.release_created }} | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.GHCR_IMAGE }} | |
| tags: | | |
| type=semver,pattern={{version}},value=${{ steps.release.outputs.tag_name }} | |
| type=semver,pattern={{major}}.{{minor}},value=${{ steps.release.outputs.tag_name }} | |
| type=semver,pattern={{major}},value=${{ steps.release.outputs.tag_name }} | |
| type=raw,value=${{ steps.release.outputs.tag_name }} | |
| type=raw,value=latest | |
| - name: Build and push Docker image | |
| if: ${{ steps.release.outputs.release_created }} | |
| uses: docker/build-push-action@v6 | |
| 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 | |
| build-args: | | |
| VERSION=${{ steps.release.outputs.tag_name }} | |
| COMMIT=${{ github.sha }} | |
| - name: Set up Go | |
| if: ${{ steps.release.outputs.release_created }} | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version-file: go.mod | |
| check-latest: true | |
| cache: true | |
| - name: Generate installer manifests | |
| if: ${{ steps.release.outputs.release_created }} | |
| run: | | |
| make build-installer IMG=${{ env.GHCR_IMAGE }}:${{ steps.release.outputs.tag_name }} | |
| - name: Upload installer manifests to release | |
| if: ${{ steps.release.outputs.release_created }} | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| gh release upload ${{ steps.release.outputs.tag_name }} dist/install.yaml | |
| - name: Warm Go module caches (proxy/sum/pkg.go.dev) | |
| if: ${{ steps.release.outputs.release_created }} | |
| run: | | |
| set -euo pipefail | |
| MOD=github.com/${{ github.repository }} | |
| VER=${{ steps.release.outputs.tag_name }} | |
| echo "Warming proxy.golang.org for $MOD@$VER" | |
| curl -sSfL "https://proxy.golang.org/${MOD}/@v/${VER}.info" || true | |
| echo "Warming sum.golang.org for $MOD@$VER" | |
| curl -sSfL "https://sum.golang.org/lookup/${MOD}@${VER}" || true | |
| echo "Triggering pkg.go.dev indexing for $MOD@$VER" | |
| curl -sSfL "https://pkg.go.dev/${MOD}@${VER}" > /dev/null || true | |
| echo "Triggering Go Report Card for $MOD" | |
| curl -X POST -F "repo=${MOD}" https://goreportcard.com/checks | |
| - name: Create release summary | |
| if: ${{ steps.release.outputs.release_created }} | |
| run: | | |
| { | |
| echo "## Release ${{ steps.release.outputs.tag_name }} 🚀" | |
| echo | |
| echo "The new version has been released and is available at:" | |
| echo "- **GitHub Release**: https://github.com/${{ github.repository }}/releases/tag/${{ steps.release.outputs.tag_name }}" | |
| echo "- **GitHub Container Registry**: \`${{ env.GHCR_IMAGE }}:${{ steps.release.outputs.tag_name }}\`" | |
| echo | |
| echo "### Installation" | |
| echo '```bash' | |
| echo "# Install using the manifest (GHCR image reference)" | |
| echo "kubectl apply -f https://github.com/${{ github.repository }}/releases/download/${{ steps.release.outputs.tag_name }}/install.yaml" | |
| echo '```' | |
| echo | |
| echo "### Pull the image" | |
| echo '```bash' | |
| echo "# From GitHub Container Registry" | |
| echo "docker pull ${{ env.GHCR_IMAGE }}:${{ steps.release.outputs.tag_name }}" | |
| echo '```' | |
| } >> "$GITHUB_STEP_SUMMARY" | |
| sync-helm-chart: | |
| name: Sync Helm chart to helm-charts repo | |
| needs: release-please | |
| if: ${{ needs.release-please.outputs.release_created == 'true' }} | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| env: | |
| CHART_NAME: bobrapet | |
| HELM_CHARTS_REPO: bubustack/helm-charts | |
| RELEASE_VERSION: ${{ needs.release-please.outputs.tag_name }} | |
| steps: | |
| - name: Check for HELM_CHARTS_TOKEN | |
| id: token-check | |
| run: | | |
| if [ -z "${{ secrets.HELM_CHARTS_TOKEN }}" ]; then | |
| echo "available=false" >> "$GITHUB_OUTPUT" | |
| echo "::warning::HELM_CHARTS_TOKEN secret not configured — skipping helm chart sync" | |
| else | |
| echo "available=true" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Checkout source | |
| if: steps.token-check.outputs.available == 'true' | |
| uses: actions/checkout@v6 | |
| - name: Setup Go | |
| if: steps.token-check.outputs.available == 'true' | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version-file: go.mod | |
| check-latest: true | |
| cache: true | |
| cache-dependency-path: go.sum | |
| - name: Stamp release version into chart | |
| if: steps.token-check.outputs.available == 'true' | |
| run: | | |
| VERSION="${RELEASE_VERSION#v}" | |
| sed -i "s/^version:.*/version: ${VERSION}/" hack/charts/${CHART_NAME}/Chart.yaml | |
| sed -i "s/^appVersion:.*/appVersion: \"${VERSION}\"/" hack/charts/${CHART_NAME}/Chart.yaml | |
| sed -i "s/^ tag:.*/ tag: \"${VERSION}\"/" hack/charts/${CHART_NAME}/values.yaml | |
| echo "Stamped chart with version ${VERSION}" | |
| - name: Build Helm chart artifacts | |
| if: steps.token-check.outputs.available == 'true' | |
| run: make helm-chart CHART=${{ env.CHART_NAME }} | |
| - name: Checkout helm-charts repository | |
| if: steps.token-check.outputs.available == 'true' | |
| uses: actions/checkout@v6 | |
| with: | |
| repository: ${{ env.HELM_CHARTS_REPO }} | |
| token: ${{ secrets.HELM_CHARTS_TOKEN }} | |
| path: helm-charts | |
| fetch-depth: 0 | |
| - name: Update chart contents | |
| if: steps.token-check.outputs.available == 'true' | |
| run: | | |
| mkdir -p helm-charts/charts | |
| rm -rf helm-charts/charts/${CHART_NAME} | |
| cp -R dist/charts/${CHART_NAME} helm-charts/charts/${CHART_NAME} | |
| - name: Detect chart changes | |
| if: steps.token-check.outputs.available == 'true' | |
| id: changes | |
| run: | | |
| cd helm-charts | |
| if git status --porcelain | grep . >/dev/null; then | |
| echo "changed=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "changed=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Open pull request in helm-charts | |
| if: >- | |
| steps.token-check.outputs.available == 'true' && | |
| steps.changes.outputs.changed == 'true' | |
| uses: peter-evans/create-pull-request@v8 | |
| with: | |
| path: helm-charts | |
| token: ${{ secrets.HELM_CHARTS_TOKEN }} | |
| commit-message: "chore: sync ${{ env.CHART_NAME }} chart ${{ env.RELEASE_VERSION }}" | |
| branch: "chore/sync-${{ env.CHART_NAME }}-${{ env.RELEASE_VERSION }}" | |
| title: "chore: sync ${{ env.CHART_NAME }} Helm chart ${{ env.RELEASE_VERSION }}" | |
| body: | | |
| Automated chart sync from `${{ github.repository }}`@`${{ env.RELEASE_VERSION }}`. | |
| - Release: `${{ env.RELEASE_VERSION }}` | |
| - Image: `ghcr.io/${{ github.repository }}:${{ env.RELEASE_VERSION }}` | |
| labels: | | |
| automation | |
| charts | |