ws4kp/.github/workflows/build-docker.yaml

47 lines
1.4 KiB
YAML
Raw Normal View History

2023-04-13 22:29:16 +00:00
name: build-docker
2023-04-13 17:43:52 +00:00
on: push
jobs:
build:
name: Build Image
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
2023-04-13 17:43:52 +00:00
steps:
- name: Checkout
uses: actions/checkout@v3
- id: short-sha
uses: benjlevesque/short-sha@v1.2
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: |
2023-04-13 22:29:16 +00:00
ghcr.io/netbymatt/ws4kp
2023-04-13 17:43:52 +00:00
tags: |
type=raw,priority=1000,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
type=ref,event=branch
${{ steps.short-sha.outputs.sha }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push
id: docker_build
uses: docker/build-push-action@v3
with:
context: .
pull: true
push: ${{ github.ref == 'refs/heads/main' }}
2023-04-13 22:29:16 +00:00
platforms: linux/amd64,linux/arm/v7,linux/arm64/v8
2023-04-13 17:43:52 +00:00
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
2023-04-13 22:29:16 +00:00
cache-to: type=gha,mode=max