Skip to content

Release

Release #12

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: read
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: Generate tag
id: tag
run: |
if [ "${{ github.event_name }}" == "pull_request" ]; then
echo "value=dev" >> $GITHUB_OUTPUT
else
name=$(echo "${{ github.ref }}" | sed 's/refs\/heads\///')
echo "value=$name" >> $GITHUB_OUTPUT
fi
- 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: 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: openfga/openfga-envoy:${{ steps.tag.outputs.value }}
- name: Write summary
if: ${{ github.event_name != 'pull_request' }}
run: |
echo "The image is available:" >> $GITHUB_STEP_SUMMARY
echo "```" >> $GITHUB_STEP_SUMMARY
echo "docker pull ghcr.io/openfga/openfga-envoy:${{ steps.tag.outputs.value }}@${{ steps.push.outputs.digest }}" >> $GITHUB_STEP_SUMMARY
echo "```" >> $GITHUB_STEP_SUMMARY