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
|
|
|
|
uses: docker/metadata-action@v4
|
|
|
|
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
|
|
|
|
uses: docker/setup-qemu-action@v2
|
|
|
|
- name: Set up Docker Buildx
|
|
|
|
uses: docker/setup-buildx-action@v2
|
|
|
|
- name: Login to GitHub Container Registry
|
|
|
|
if: github.event_name != 'pull_request'
|
|
|
|
uses: docker/login-action@v2
|
|
|
|
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
|
2023-11-30 02:54:13 +09:00
|
|
|
uses: docker/build-push-action@v5
|
2023-01-22 07:41:17 +09:00
|
|
|
with:
|
|
|
|
context: .
|
|
|
|
platforms: linux/amd64
|
|
|
|
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
|