Skip to content

updates to deprecated label and FromAsCasing #27

updates to deprecated label and FromAsCasing

updates to deprecated label and FromAsCasing #27

name: Docker
on:
push:
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log in to GitHub container registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Login against DockerHub registry except on PR
- name: Log in to DockerHub container registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: vifebot
password: ${{ secrets.VIFEBOT_DOCKERHUB_TOKEN }}
# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/edirom/odd-api
edirom/odd-api
flavor: |
latest=${{ github.ref == 'refs/heads/main' }}
# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
platforms: |
linux/amd64
linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
clean:
name: remove untagged images from Github package registry
runs-on: ubuntu-latest
permissions:
packages: write
needs: build
steps:
- name: ghcr.io cleanup action
uses: dataaxiom/ghcr-cleanup-action@v1
with:
package: odd-api
delete-untagged: true
dry-run: false
validate: true
older-than: 2 weeks
token: ${{ secrets.GITHUB_TOKEN }}