Skip to content

v4.0.0 - Stable Release #9

v4.0.0 - Stable Release

v4.0.0 - Stable Release #9

name: Container Image Release
concurrency: production
on:
release:
types: [published]
jobs:
release-app-image:
runs-on: ubuntu-latest
name: Release App container image
steps:
- name: Check if base container image exists
id: baseImageExists
run: |
GHCR_TOKEN=$(echo ${{ secrets.GITHUB_TOKEN }} | base64)
curl --fail -H "Authorization: Bearer ${GHCR_TOKEN}" https://ghcr.io/v2/jikan-me/jikan-rest-php/tags/list | grep -q latest
- name: Base image existance check failed
if: ${{ always() && steps.baseImageExists.outcome == 'failure' }}
run: echo "Base image doesn't exist yet. Please run the base image creation workflow first."
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up qemu
uses: docker/setup-qemu-action@v2
- name: Set up docker buildx
uses: docker/setup-buildx-action@v3
with:
platforms: linux/amd64,linux/arm64
- name: Read metadata
id: meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/jikan-me/jikan-rest
jikanme/jikan-rest
tags: |
type=raw,value=${{ github.ref_name }}
type=sha
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
push: true
context: .
# let's use github action cache storage
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
GITHUB_PERSONAL_TOKEN=${{ secrets.GITHUB_TOKEN }}
BASE_IMAGE_VERSION=latest
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}