2023-01-22 01:51:18 +03:00
|
|
|
name: build & push docker container
|
2023-01-22 01:41:17 +03:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
tags:
|
|
|
|
- '*'
|
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
jobs:
|
|
|
|
docker:
|
|
|
|
runs-on: ubuntu-latest
|
2023-01-22 01:51:18 +03:00
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
packages: write
|
2023-01-22 01:41:17 +03:00
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2023-11-29 20:54:45 +03:00
|
|
|
uses: actions/checkout@v4
|
2023-01-22 01:41:17 +03:00
|
|
|
- name: Docker meta
|
|
|
|
id: metal
|
2024-01-10 18:02:29 +03:00
|
|
|
uses: docker/metadata-action@v5
|
2023-01-22 01:41:17 +03:00
|
|
|
with:
|
|
|
|
images: |
|
2023-05-21 19:29:29 +03:00
|
|
|
ghcr.io/${{ github.repository }}
|
2023-01-22 01:41:17 +03:00
|
|
|
- name: Set up QEMU
|
2024-01-15 11:35:52 +03:00
|
|
|
uses: docker/setup-qemu-action@v3
|
2023-01-22 01:41:17 +03:00
|
|
|
- name: Set up Docker Buildx
|
2024-01-10 16:46:05 +03:00
|
|
|
uses: docker/setup-buildx-action@v3
|
2023-01-22 01:41:17 +03:00
|
|
|
- name: Login to GitHub Container Registry
|
|
|
|
if: github.event_name != 'pull_request'
|
2024-01-10 17:01:10 +03:00
|
|
|
uses: docker/login-action@v3
|
2023-01-22 01:41:17 +03:00
|
|
|
with:
|
|
|
|
registry: ghcr.io
|
2023-05-21 19:29:29 +03:00
|
|
|
username: ${{ github.actor }}
|
|
|
|
password: ${{ github.token }}
|
2023-01-22 01:41:17 +03:00
|
|
|
- name: Build and push
|
2023-11-29 20:54:13 +03:00
|
|
|
uses: docker/build-push-action@v5
|
2023-01-22 01:41:17 +03: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
|