Skip to content

Release

Release #25

Workflow file for this run

name: Release
on:
pull_request:
branches:
- "main"
paths:
- ".github/workflows/release.yaml"
workflow_dispatch:
jobs:
build-and-release:
runs-on: ubuntu-latest
permissions:
packages: write
contents: write
steps:
- name: Checkout
if: ${{ github.event_name == 'pull_request' }}
uses: actions/checkout@v4
- name: Checkout
if: ${{ github.event_name != 'pull_request' }}
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: 1.22.1
- name: Build
run: make build
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GHCR
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: |
ghcr.io/${{ github.repository }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}
- name: Build and push
id: push
uses: docker/build-push-action@v5
with:
context: extauthz
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Write summary
if: ${{ github.event_name != 'pull_request' }}
run: |
echo "The image is available:" >> $GITHUB_STEP_SUMMARY
echo "<strong>linux/amd64</strong>" >> $GITHUB_STEP_SUMMARY
echo "<pre>" >> $GITHUB_STEP_SUMMARY
echo "docker pull --platform=linux/amd64 ${{ steps.meta.outputs.tags }}@${{ steps.push.outputs.digest }}" >> $GITHUB_STEP_SUMMARY
echo "</pre>" >> $GITHUB_STEP_SUMMARY
echo "<strong>linux/arm64</strong>" >> $GITHUB_STEP_SUMMARY
echo "<pre>" >> $GITHUB_STEP_SUMMARY
echo "docker pull --platform=linux/arm64 ${{ steps.meta.outputs.tags }}@${{ steps.push.outputs.digest }}" >> $GITHUB_STEP_SUMMARY
echo "</pre>" >> $GITHUB_STEP_SUMMARY