wildduck/.github/workflows/docker.yml

57 lines
2.1 KiB
YAML
Raw Normal View History

2022-03-05 20:48:10 +08:00
name: Build and publish a Docker image to Docker hub and ghcr.io
on:
push:
branches:
- master
2023-03-30 19:21:10 +08:00
- docker
2022-03-05 20:48:10 +08:00
tags:
- 'v*.*.*'
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
# list of Docker images to use as base name for tags
images: |
nodemailer/wildduck
ghcr.io/nodemailer/wildduck
# generate Docker tags based on the following events/attributes
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
2023-03-30 19:27:22 +08:00
with:
platforms: 'arm64,arm'
2022-03-05 20:48:10 +08:00
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GHCR
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
2023-03-30 18:46:41 +08:00
platforms: linux/amd64,linux/arm/v8,linux/arm64
2022-03-05 20:48:10 +08:00
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}