|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + release: |
| 5 | + types: [published] |
| 6 | + workflow_dispatch: |
| 7 | + |
| 8 | +env: |
| 9 | + REGISTRY: ghcr.io |
| 10 | + IMAGE_NAME: ${{ github.repository }} |
| 11 | + |
| 12 | +jobs: |
| 13 | + build-and-push: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + permissions: |
| 16 | + contents: read |
| 17 | + packages: write |
| 18 | + |
| 19 | + strategy: |
| 20 | + matrix: |
| 21 | + binary: [proxy-client, proxy-server] |
| 22 | + |
| 23 | + steps: |
| 24 | + - name: Checkout repository |
| 25 | + uses: actions/checkout@v4 |
| 26 | + with: |
| 27 | + fetch-depth: 0 # Needed for git describe to work properly |
| 28 | + |
| 29 | + # Add buildx setup |
| 30 | + - name: Set up Docker Buildx |
| 31 | + uses: docker/setup-buildx-action@v3 |
| 32 | + with: |
| 33 | + buildkitd-flags: --debug |
| 34 | + |
| 35 | + - name: Log in to the Container registry |
| 36 | + uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 |
| 37 | + with: |
| 38 | + registry: ${{ env.REGISTRY }} |
| 39 | + username: ${{ github.actor }} |
| 40 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 41 | + |
| 42 | + - name: Extract metadata (tags, labels) for Docker |
| 43 | + id: meta |
| 44 | + uses: docker/metadata-action@9ec57ed1fcdf50867830130cc04c4d1bb9de141d |
| 45 | + with: |
| 46 | + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-${{ matrix.binary }} |
| 47 | + tags: | |
| 48 | + type=semver,pattern={{version}} |
| 49 | + type=semver,pattern={{major}}.{{minor}} |
| 50 | + type=sha |
| 51 | +
|
| 52 | + - name: Build and push Docker image |
| 53 | + uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 |
| 54 | + with: |
| 55 | + context: . |
| 56 | + file: Dockerfile |
| 57 | + platforms: linux/amd64 |
| 58 | + provenance: false # Disable build metadata that could affect reproducibility |
| 59 | + build-args: | |
| 60 | + BINARY=${{ matrix.binary }} |
| 61 | + push: true |
| 62 | + tags: ${{ steps.meta.outputs.tags }} |
| 63 | + labels: ${{ steps.meta.outputs.labels }} |
0 commit comments