ci: auto-create GitHub release on sidecar-v*/plugin-v* tags #43
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: Build sidecar image | |
| on: | |
| push: | |
| branches: [main] | |
| tags: ['sidecar-v*'] | |
| paths: | |
| - 'sidecar/**' | |
| - '.github/workflows/build-sidecar.yml' | |
| workflow_dispatch: | |
| env: | |
| GHCR_IMAGE: ghcr.io/sipioteo/mcpbouncer-sidecar | |
| DOCKERHUB_IMAGE: docker.io/sipioteo/mcpbouncer-sidecar | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| packages: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to GHCR | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Log in to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: docker.io | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Compute image tags and labels | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: | | |
| ${{ env.GHCR_IMAGE }} | |
| ${{ env.DOCKERHUB_IMAGE }} | |
| tags: | | |
| type=ref,event=branch | |
| type=sha,prefix=sha-,format=short | |
| type=match,pattern=sidecar-(v.*),group=1 | |
| type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') || startsWith(github.ref, 'refs/tags/sidecar-v') }} | |
| labels: | | |
| org.opencontainers.image.title=mcpbouncer-sidecar | |
| org.opencontainers.image.description=OAuth 2.1 / OIDC bouncer sidecar for MCP servers | |
| org.opencontainers.image.source=https://github.com/Sipioteo/MCPBouncer | |
| org.opencontainers.image.licenses=MIT | |
| - name: Build and push | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: ./sidecar | |
| file: ./sidecar/Dockerfile | |
| 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 | |
| provenance: false | |
| - name: Compute release name | |
| if: startsWith(github.ref, 'refs/tags/sidecar-v') | |
| id: relname | |
| run: echo "name=Sidecar ${GITHUB_REF_NAME#sidecar-}" >> "$GITHUB_OUTPUT" | |
| - name: Create GitHub release | |
| if: startsWith(github.ref, 'refs/tags/sidecar-v') | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| name: ${{ steps.relname.outputs.name }} | |
| generate_release_notes: true | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Sync Docker Hub description from README | |
| uses: peter-evans/dockerhub-description@v4 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| repository: sipioteo/mcpbouncer-sidecar | |
| short-description: "OAuth 2.1 / OIDC bouncer sidecar for MCP servers (Traefik companion)" | |
| readme-filepath: ./README.md | |
| enable-url-completion: true |