Push docker images also to ghcr.io
Fixes #350. Change-Id: Ifdb7e4e7fda46efd0ed9e760587033f52ff4a130
This commit is contained in:
parent
c9cb9aa9e0
commit
08dc5f6271
48
.github/workflows/docker-release.yml
vendored
48
.github/workflows/docker-release.yml
vendored
@ -1,51 +1,61 @@
|
|||||||
name: Create docker image(s) and push to docker hub
|
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:
|
on:
|
||||||
push:
|
push:
|
||||||
# Sequence of patterns matched against refs/heads
|
# Sequence of patterns matched against refs/heads
|
||||||
# prettier-ignore
|
# prettier-ignore
|
||||||
branches:
|
branches:
|
||||||
# Push events on master branch
|
# Push events on master branch
|
||||||
- master
|
- master
|
||||||
# Sequence of patterns matched against refs/tags
|
# Sequence of patterns matched against refs/tags
|
||||||
tags:
|
tags:
|
||||||
- '[0-9]+\.[0-9]+\.[0-9]+' # Push events to 0.X.X tag
|
- '[0-9]+\.[0-9]+\.[0-9]+' # Push events to 0.X.X tag
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
docker:
|
docker:
|
||||||
|
name: Push Docker image to multiple registries
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
packages: write
|
||||||
|
contents: read
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v3
|
uses: docker/setup-qemu-action@v3
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
- name: Login to DockerHub
|
- name: Login to DockerHub
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
- name: Calculate docker image tag
|
|
||||||
id: set-tag
|
- name: Login to GHCR
|
||||||
run: |
|
uses: docker/login-action@v3
|
||||||
case "${GITHUB_REF}" in
|
with:
|
||||||
refs/heads/master|refs/heads/main)
|
registry: ghcr.io
|
||||||
tag=latest
|
username: ${{ github.actor }}
|
||||||
;;
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
refs/tags/*)
|
|
||||||
tag=${GITHUB_REF#refs/tags/}
|
- name: Extract metadata (tags, labels) for Docker
|
||||||
;;
|
id: meta
|
||||||
*)
|
uses: docker/metadata-action@v5
|
||||||
tag=${GITHUB_SHA}
|
with:
|
||||||
;;
|
images: |
|
||||||
esac
|
awesometechnologies/synapse-admin
|
||||||
echo "::set-output name=tag::$tag"
|
ghcr.io/${{ github.repository }}
|
||||||
|
|
||||||
- name: Build and Push Tag
|
- name: Build and Push Tag
|
||||||
uses: docker/build-push-action@v5
|
uses: docker/build-push-action@v5
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
push: true
|
push: true
|
||||||
tags: "awesometechnologies/synapse-admin:${{ steps.set-tag.outputs.tag }}"
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
platforms: linux/amd64,linux/arm64
|
platforms: linux/amd64,linux/arm64
|
||||||
|
Loading…
Reference in New Issue
Block a user