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