2024-04-18 14:37:56 +00:00
|
|
|
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
|
2021-08-24 08:44:17 +00:00
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
2021-12-08 21:02:43 +00:00
|
|
|
# Sequence of patterns matched against refs/heads
|
|
|
|
# prettier-ignore
|
2024-04-18 14:37:56 +00:00
|
|
|
branches:
|
2021-12-08 21:02:43 +00:00
|
|
|
# Push events on master branch
|
|
|
|
- master
|
|
|
|
# Sequence of patterns matched against refs/tags
|
2024-04-18 14:37:56 +00:00
|
|
|
tags:
|
2021-12-08 21:02:43 +00:00
|
|
|
- '[0-9]+\.[0-9]+\.[0-9]+' # Push events to 0.X.X tag
|
2021-08-24 08:44:17 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
docker:
|
2024-04-18 14:37:56 +00:00
|
|
|
name: Push Docker image to multiple registries
|
2021-08-24 08:44:17 +00:00
|
|
|
runs-on: ubuntu-latest
|
2024-04-18 14:37:56 +00:00
|
|
|
permissions:
|
|
|
|
packages: write
|
|
|
|
contents: read
|
2021-08-24 08:44:17 +00:00
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2023-09-05 06:23:03 +00:00
|
|
|
uses: actions/checkout@v4
|
2024-04-18 19:11:41 +00:00
|
|
|
with:
|
2024-04-23 10:18:38 +00:00
|
|
|
fetch-depth: 0
|
2024-04-18 14:37:56 +00:00
|
|
|
|
2021-08-24 08:44:17 +00:00
|
|
|
- name: Set up QEMU
|
2024-02-02 14:04:05 +00:00
|
|
|
uses: docker/setup-qemu-action@v3
|
2024-04-18 14:37:56 +00:00
|
|
|
|
2021-08-24 08:44:17 +00:00
|
|
|
- name: Set up Docker Buildx
|
2024-02-02 14:04:39 +00:00
|
|
|
uses: docker/setup-buildx-action@v3
|
2024-04-18 14:37:56 +00:00
|
|
|
|
2021-08-24 08:44:17 +00:00
|
|
|
- name: Login to DockerHub
|
2024-02-02 14:04:29 +00:00
|
|
|
uses: docker/login-action@v3
|
2021-08-24 08:44:17 +00:00
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
2024-04-18 14:37:56 +00:00
|
|
|
|
|
|
|
- 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 }}
|
|
|
|
|
2021-12-08 21:02:43 +00:00
|
|
|
- name: Build and Push Tag
|
2024-02-02 14:03:52 +00:00
|
|
|
uses: docker/build-push-action@v5
|
2021-08-24 08:44:17 +00:00
|
|
|
with:
|
|
|
|
context: .
|
|
|
|
push: true
|
2024-04-18 14:37:56 +00:00
|
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
|
|
labels: ${{ steps.meta.outputs.labels }}
|
2021-12-08 21:02:43 +00:00
|
|
|
platforms: linux/amd64,linux/arm64
|