Fix CI workflow triggers and kubectl version #1
Workflow file for this run
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 | |
| on: | |
| push: | |
| tags: | |
| - "v*.*.*" # Triggers on version tags like v1.0.0, v0.1.0, etc. | |
| permissions: | |
| contents: write | |
| packages: write | |
| id-token: write | |
| attestations: write | |
| jobs: | |
| release: | |
| name: Build and Release | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: go.mod | |
| - name: Cache Go modules | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cache/go-build | |
| ~/go/pkg/mod | |
| key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
| restore-keys: | | |
| ${{ runner.os }}-go- | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.repository_owner }} | |
| password: ${{ secrets.GHCR_TOKEN }} | |
| - name: Extract version from tag | |
| id: version | |
| run: | | |
| VERSION=${GITHUB_REF#refs/tags/} | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| echo "Releasing version: $VERSION" | |
| - name: Build and push multi-platform container images | |
| run: | | |
| # Convert to lowercase (GHCR requirement) | |
| OWNER_LC=$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]') | |
| export IMG=ghcr.io/${OWNER_LC}/folder-controller:${{ steps.version.outputs.version }} | |
| export IMG_LATEST=ghcr.io/${OWNER_LC}/folder-controller:latest | |
| # Build and push with version tag | |
| make docker-buildx IMG=$IMG | |
| # Also tag as latest | |
| docker buildx imagetools create $IMG --tag $IMG_LATEST | |
| - name: Generate installable manifest | |
| run: | | |
| # Convert to lowercase (GHCR requirement) | |
| OWNER_LC=$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]') | |
| export IMG=ghcr.io/${OWNER_LC}/folder-controller:${{ steps.version.outputs.version }} | |
| make build-installer | |
| - name: Verify manifest was created | |
| run: | | |
| if [ ! -f dist/install.yaml ]; then | |
| echo "Error: dist/install.yaml was not created" | |
| exit 1 | |
| fi | |
| echo "Manifest size: $(wc -c < dist/install.yaml) bytes" | |
| echo "Manifest preview (first 50 lines):" | |
| head -n 50 dist/install.yaml | |
| - name: Create Release Notes | |
| id: release_notes | |
| run: | | |
| # Convert to lowercase (GHCR requirement) | |
| OWNER_LC=$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]') | |
| cat > release_notes.md << EOF | |
| ## Folder Controller ${{ steps.version.outputs.version }} | |
| ### Installation | |
| Install the Folder controller using the provided manifest: | |
| \`\`\`bash | |
| kubectl apply -f https://github.com/${{ github.repository }}/releases/download/${{ steps.version.outputs.version }}/install.yaml | |
| \`\`\` | |
| ### Container Images | |
| Multi-platform container images are available at: | |
| - \`ghcr.io/${OWNER_LC}/folder-controller:${{ steps.version.outputs.version }}\` | |
| - \`ghcr.io/${OWNER_LC}/folder-controller:latest\` | |
| Supported architectures: | |
| - linux/amd64 | |
| - linux/arm64 | |
| - linux/s390x | |
| - linux/ppc64le | |
| ### What's Changed | |
| <!-- Add your changelog here or auto-generate it --> | |
| **Full Changelog**: https://github.com/${{ github.repository }}/compare/v0.0.0...${{ steps.version.outputs.version }} | |
| EOF | |
| cat release_notes.md | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: | | |
| dist/install.yaml | |
| body_path: release_notes.md | |
| draft: false | |
| prerelease: false | |
| generate_release_notes: true | |
| env: | |
| GHCR_TOKEN: ${{ secrets.GHCR_TOKEN }} | |
| - name: Summary | |
| run: | | |
| # Convert to lowercase (GHCR requirement) | |
| OWNER_LC=$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]') | |
| echo "## Release Summary" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "✅ **Version**: ${{ steps.version.outputs.version }}" >> $GITHUB_STEP_SUMMARY | |
| echo "✅ **Container Image**: ghcr.io/${OWNER_LC}/folder-controller:${{ steps.version.outputs.version }}" >> $GITHUB_STEP_SUMMARY | |
| echo "✅ **Installable Manifest**: Attached to release" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "### Installation Command" >> $GITHUB_STEP_SUMMARY | |
| echo '```bash' >> $GITHUB_STEP_SUMMARY | |
| echo "kubectl apply -f https://github.com/${{ github.repository }}/releases/download/${{ steps.version.outputs.version }}/install.yaml" >> $GITHUB_STEP_SUMMARY | |
| echo '```' >> $GITHUB_STEP_SUMMARY |