Files
voyage/.github/workflows/backend-release.yml

62 lines
1.8 KiB
YAML

name: Upload the tagged release backend image to GHCR
permissions:
contents: read
packages: write
on:
release:
types: [released]
env:
IMAGE_NAME: "voyage-backend"
PYTHON_IMAGE: "python:3.13-slim"
jobs:
upload:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Set lower case owner name
id: repo_owner
run: |
LOWER_OWNER="${OWNER,,}"
echo "REPO_OWNER=${LOWER_OWNER}" >>"$GITHUB_ENV"
echo "repo_owner=${LOWER_OWNER}" >>"$GITHUB_OUTPUT"
env:
OWNER: "${{ github.repository_owner }}"
- name: Build and push release Docker image with BuildKit cache
uses: docker/build-push-action@v5
with:
context: ./backend
platforms: linux/amd64,linux/arm64
build-args: |
PYTHON_IMAGE=${{ env.PYTHON_IMAGE }}
push: true
tags: |
ghcr.io/${{ steps.repo_owner.outputs.repo_owner }}/${{ env.IMAGE_NAME }}:${{ github.event.release.tag_name }}
cache-from: |
type=registry,ref=ghcr.io/${{ steps.repo_owner.outputs.repo_owner }}/${{ env.IMAGE_NAME }}:buildcache
type=local,src=/tmp/.buildx-cache
cache-to: |
type=registry,ref=ghcr.io/${{ steps.repo_owner.outputs.repo_owner }}/${{ env.IMAGE_NAME }}:buildcache,mode=max
type=local,dest=/tmp/.buildx-cache,mode=max
env:
DOCKER_BUILDKIT: 1