fix: use 204 response code #66
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# _ | |
# _ | |
# _ __ ___ ___ __ _| |_ ___ | |
# | '__/ _ \ / __/ _` | __/ __| | |
# | | | (_) | (_| (_| | |_\__ \ | |
# |_| \___/ \___\__,_|\__|___/ | |
# | |
# https://github.com/rocats/apigateway-interceptor | |
# | |
# Copyright (C) 2023 @rocats | |
# | |
# This is a self-hosted software, liscensed under the Apache License. | |
# See /License for more information. | |
name: Build OCI Container (Prod) | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- 'main' | |
paths: | |
- "src/**/*.py" | |
- ".github/workflows/pr-build.yml" | |
- ".github/workflows/prod-build.yml" | |
env: | |
REGISTRY: quay.io | |
QUAY_USER: rocats | |
IMAGE_NAME: ${{ github.repository }} | |
DOCKERFILE: Dockerfile | |
DEPLOY_STAGE: prod | |
jobs: | |
build: | |
strategy: | |
matrix: | |
include: | |
- os: linux | |
arch: amd64 | |
platform: linux/amd64 | |
- os: linux | |
arch: arm64 | |
platform: linux/arm64 | |
fail-fast: false | |
runs-on: ubuntu-latest | |
env: | |
CGO_ENABLED: 0 | |
PYTHON_VERSION: 3.12 | |
outputs: | |
IMAGE_URI: ${{ steps.metadata.outputs.tags }} | |
REV_COUNT: ${{ steps.get_rev_count.outputs.count }} | |
steps: | |
- uses: actions/checkout@master | |
with: | |
fetch-depth: 0 | |
- name: Get revision count | |
id: get_rev_count | |
env: | |
REF: ${{ github.ref }} | |
run: | | |
echo "count=$(git rev-list --count HEAD)" >> $GITHUB_OUTPUT | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- uses: docker/metadata-action@v5 | |
id: metadata | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
tags: | | |
type=sha,enable=true,format=short,prefix=${{ env.DEPLOY_STAGE }}-,suffix=-r${{ steps.get_rev_count.outputs.count }}-${{ matrix.os }}-${{ matrix.arch }} | |
- name: Kaniko build - ${{ env.REGISTRY }} | |
id: quay_build | |
uses: aevea/action-kaniko@master | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ env.QUAY_USER }} | |
password: ${{ secrets.QUAY_PASS }} | |
image: ${{ env.IMAGE_NAME }} | |
build_file: ${{ env.DOCKERFILE }} | |
tag: ${{ fromJSON(steps.metadata.outputs.json).labels['org.opencontainers.image.version'] }} | |
tag_with_latest: false | |
cache: true | |
cache_registry: ${{ env.REGISTRY }}/${{ env.QUAY_USER }}/cache | |
extra_args: --build-arg PYTHON_VERSION=${{ env.PYTHON_VERSION }} --build-arg opts="GOARCH=${{ matrix.arch }}" --custom-platform ${{ matrix.platform }} | |
- name: Echo image uri | |
run: | | |
echo "ImageURI ${{ steps.metadata.outputs.tags }}" | |
push-multiarch-images: | |
needs: [build] | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: read | |
env: | |
QUAY_USER: rocats | |
steps: | |
- name: Login to ${{ env.REGISTRY }} | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ env.QUAY_USER }} | |
password: ${{ secrets.QUAY_PASS }} | |
- uses: docker/metadata-action@v5 | |
id: metadata | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
tags: | | |
type=raw,enable=true,value={{sha}}-r${{ needs.build.outputs.REV_COUNT }},prefix=${{ env.DEPLOY_STAGE }}- | |
type=raw,value=latest | |
- name: Push multi-arch images | |
uses: int128/docker-manifest-create-action@v1 | |
with: | |
tags: ${{ steps.metadata.outputs.tags }} | |
suffixes: | | |
-linux-amd64 | |
-linux-arm64 |