Skip to content

Publish Image to Quay #12

Publish Image to Quay

Publish Image to Quay #12

Workflow file for this run

name: Publish Image to Quay
on:
release:
types: [published]
workflow_dispatch:
inputs:
tag:
description: "Name of the tag for the published image"
type: string
required: true
env:
IMAGE_NAME: trestle-bot
IMAGE_REGISTRY: quay.io
jobs:
publish-image:
runs-on: 'ubuntu-latest'
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Quay
uses: docker/login-action@v3
with:
username: ${{ secrets.QUAY_USER }}
password: ${{ secrets.QUAY_TOKEN }}
registry: ${{ env.IMAGE_REGISTRY }}
- name: Check if triggered by release or workflow dispatch
id: check_event
run: echo "event_type=${{ toJson(github.event_name) }}" >> "$GITHUB_OUTPUT"
# Using intermediary variable to process event based input
- name: Set TAG environment variable for Release
if: steps.check_event.outputs.event_type == 'release'
run: echo "TAG=$RELEASE_VERSION" >> "$GITHUB_ENV"
env:
RELEASE_VERSION: ${{ github.event.release.tag_name }}
- name: Set TAG environment variable for Workflow Dispatch
if: steps.check_event.outputs.event_type == 'workflow_dispatch'
run: echo "TAG=$INPUT_VERSION" >> "$GITHUB_ENV"
env:
INPUT_VERSION: ${{ github.event.inputs.tag }}
- name: Build and Push
uses: docker/build-push-action@v5
with:
push: true
tags: ${{ env.IMAGE_REGISTRY }}/${{ vars.QUAY_ORG }}/${{ env.IMAGE_NAME }}:${{ env.TAG }}
cache-from: type=gha
cache-to: type=gha,mode=max