Publish Multi Platform Docker Images #9
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
name: Publish Multi Platform Docker Images | |
on: | |
schedule: | |
- cron: '0 0 * * 0' | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
GITHUB: ghcr.io | |
GITLAB: registry.gitlab.com | |
DOCKERFILE: ./Dockerfile | |
MULTI_ARCH: true | |
GLCR: ${{ secrets.GLCR_SLUG }} | |
GHCR: ${{ secrets.GHCR_SLUG }} | |
GLCR_PASSWORD: ${{ secrets.GLCR_TOKEN }} | |
GHCR_PASSWORD: ${{ secrets.GHCR_TOKEN }} | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
name: Publish Images | |
permissions: | |
contents: read | |
packages: write | |
id-token: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3.7.1 | |
- name: Extract Docker Metadata | |
id: meta | |
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1 | |
with: | |
images: | | |
${{ env.GHCR }} | |
${{ env.GLCR }} | |
tags: | | |
type=edge | |
flavor: | | |
latest=true | |
labels: | | |
org.opencontainers.image.title=Classics | |
org.opencontainers.image.vendor=Vedansh | |
org.opencontainers.image.multi-platform=true | |
org.opencontainers.image.source=https://github.com/offensive-vk/Classics | |
- name: Install Cosign | |
if: github.event_name != 'pull_request' | |
uses: sigstore/cosign-installer@dc72c7d5c4d10cd6bcb8cf6e3fd625a9e5e537da #v3.7.0 | |
with: | |
cosign-release: 'v2.1.1' | |
- name: Login to Gitlab Container Registry | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@3b8fed7e4b60203b2aa0ecc6c6d6d91d12c06760 # v3.0.0 | |
with: | |
registry: ${{ env.GITLAB }} | |
username: ${{ github.repository_owner }} | |
password: ${{ env.GLCR_PASSWORD }} | |
- name: Login to Github Container Registry | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.GITHUB }} | |
username: ${{ github.repository_owner }} | |
password: ${{ env.GHCR_PASSWORD }} | |
- name: Build and Push Image | |
id: build-and-push | |
uses: docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75 # v5.0.0 | |
with: | |
context: . | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/amd64/v2,linux/amd64/v3 | |
- name: Check Manifests | |
if: github.event_name != 'pull_request' | |
run: | | |
docker buildx imagetools inspect ${{ env.GLCR }}:${{ steps.meta.outputs.version }} | |
docker buildx imagetools inspect ${{ env.GHCR }}:${{ steps.meta.outputs.version }} | |
- name: Inspect Image | |
if: github.event_name != 'pull_request' | |
run: | | |
docker pull ${{ env.GHCR }}:${{ steps.meta.outputs.version }} | |
docker image inspect ${{ env.GHCR }}:${{ steps.meta.outputs.version }} | |
docker pull ${{ env.GLCR }}:${{ steps.meta.outputs.version }} | |
docker image inspect ${{ env.GLCR }}:${{ steps.meta.outputs.version }} | |
- name: Verify Tags and Labels | |
run: | | |
echo "## Action Summary - Docker CI " >> $GITHUB_STEP_SUMMARY | |
echo "${{ steps.meta.outputs.labels }} " >> $GITHUB_STEP_SUMMARY |