Files
Manuel Stahl 7b4258ca1b Update GitHub docker workflow
Change-Id: I1ea71209a545419c74193343a2986f5376a58a51
2022-02-19 19:00:00 +01:00

70 lines
2.0 KiB
YAML

name: Create docker image(s) and push to docker hub and ghcr.io
# see https://docs.github.com/en/actions/publishing-packages/publishing-docker-images#publishing-images-to-docker-hub-and-github-packages
on:
push:
# Sequence of patterns matched against refs/heads
# prettier-ignore
branches:
# Push events on amp.chat branch
- amp.chat
# Sequence of patterns matched against refs/tags
tags:
- 'AMP/[0-9]+\.[0-9]+' # Push events to AMP/20XX.YY tag
- 'AMP/[0-9]+\.[0-9]+\.[0-9]+' # Push events to AMP/20XX.YY.Z tag
jobs:
docker:
name: Push Docker image to multiple registries
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: |
awesometechnologies/synapse-admin
ghcr.io/${{ github.repository }}
flavor: |
latest=false
tags: |
type=ref,event=branch
type=match,pattern=AMP/(.*),group=1,prefix=AMP_,event=tag
- name: Build and Push Tag
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64