2023-06-07 09:34:22 +00:00
|
|
|
name: Build and Publish Docker
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches: ["master"]
|
|
|
|
paths-ignore: ["README.md"]
|
|
|
|
pull_request:
|
|
|
|
branches: ["master"]
|
|
|
|
paths-ignore: ["README.md"]
|
|
|
|
|
|
|
|
env:
|
|
|
|
IMAGE_NAME: ${{ github.repository }}
|
|
|
|
|
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
packages: write
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout repository
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
|
|
|
|
- name: Set up QEMU
|
|
|
|
id: qemu
|
|
|
|
uses: docker/setup-qemu-action@v2
|
|
|
|
with:
|
|
|
|
platforms: arm64
|
|
|
|
|
|
|
|
- name: Setup Docker buildx
|
|
|
|
id: buildx
|
|
|
|
uses: docker/setup-buildx-action@v2
|
|
|
|
|
|
|
|
- name: Log in to GHCR
|
|
|
|
uses: docker/login-action@v2
|
|
|
|
with:
|
|
|
|
registry: ghcr.io
|
|
|
|
username: ${{ github.actor }}
|
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|
|
|
|
- name: Extract Docker metadata
|
|
|
|
id: meta
|
|
|
|
uses: docker/metadata-action@v4
|
|
|
|
with:
|
2023-06-07 09:50:13 +00:00
|
|
|
images: |
|
|
|
|
ghcr.io/${{ env.IMAGE_NAME }}
|
|
|
|
|
2023-06-07 09:34:22 +00:00
|
|
|
|
2023-06-07 09:50:13 +00:00
|
|
|
- name: Build and push all platforms Docker image
|
2023-06-07 09:34:22 +00:00
|
|
|
id: build-and-push
|
|
|
|
uses: docker/build-push-action@v4
|
|
|
|
with:
|
|
|
|
context: .
|
|
|
|
push: ${{ github.event_name != 'pull_request' }}
|
|
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
|
|
labels: ${{ steps.meta.outputs.labels }}
|
2023-06-07 09:50:13 +00:00
|
|
|
platforms: linux/amd64,linux/arm64
|
2023-06-07 09:34:22 +00:00
|
|
|
cache-from: type=gha
|
|
|
|
cache-to: type=gha,mode=max
|