2023-01-22 07:51:18 +09:00
|
|
|
name: build & push docker container
|
2023-01-22 07:41:17 +09:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
tags:
|
|
|
|
- '*'
|
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
jobs:
|
|
|
|
docker:
|
|
|
|
runs-on: ubuntu-latest
|
2023-01-22 07:51:18 +09:00
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
packages: write
|
2023-01-22 07:41:17 +09:00
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2023-11-30 02:54:45 +09:00
|
|
|
uses: actions/checkout@v4
|
2023-01-22 07:41:17 +09:00
|
|
|
- name: Docker meta
|
|
|
|
id: metal
|
2024-01-11 00:02:29 +09:00
|
|
|
uses: docker/metadata-action@v5
|
2023-01-22 07:41:17 +09:00
|
|
|
with:
|
|
|
|
images: |
|
2023-05-22 01:29:29 +09:00
|
|
|
ghcr.io/${{ github.repository }}
|
2023-01-22 07:41:17 +09:00
|
|
|
- name: Set up QEMU
|
2024-01-15 17:35:52 +09:00
|
|
|
uses: docker/setup-qemu-action@v3
|
2023-01-22 07:41:17 +09:00
|
|
|
- name: Set up Docker Buildx
|
2024-01-10 22:46:05 +09:00
|
|
|
uses: docker/setup-buildx-action@v3
|
2023-01-22 07:41:17 +09:00
|
|
|
- name: Login to GitHub Container Registry
|
|
|
|
if: github.event_name != 'pull_request'
|
2024-01-10 23:01:10 +09:00
|
|
|
uses: docker/login-action@v3
|
2023-01-22 07:41:17 +09:00
|
|
|
with:
|
|
|
|
registry: ghcr.io
|
2023-05-22 01:29:29 +09:00
|
|
|
username: ${{ github.actor }}
|
|
|
|
password: ${{ github.token }}
|
2023-01-22 07:41:17 +09:00
|
|
|
- name: Build and push
|
2024-06-24 12:00:20 +09:00
|
|
|
uses: docker/build-push-action@v6
|
2023-01-22 07:41:17 +09:00
|
|
|
with:
|
|
|
|
context: .
|
2024-03-18 00:15:04 +09:00
|
|
|
platforms: linux/amd64,linux/arm64
|
2023-01-22 07:41:17 +09:00
|
|
|
push: ${{ github.event_name != 'pull_request' }}
|
|
|
|
tags: ${{ steps.metal.outputs.tags }}
|
|
|
|
labels: ${{ steps.metal.outputs.labels }}
|
|
|
|
cache-from: type=gha
|
|
|
|
cache-to: type=gha,mode=max
|