Publish Docker images to GitHub Container Registry

This commit is contained in:
Frédéric Guillot 2020-10-28 21:18:07 -07:00
parent 519fbcf581
commit a37a2dd043
1 changed files with 10 additions and 4 deletions

View File

@ -6,7 +6,7 @@ on:
tags:
- '*.*.*'
jobs:
multi:
docker-images:
runs-on: ubuntu-latest
steps:
- name: Checkout
@ -21,13 +21,12 @@ jobs:
DOCKER_VERSION=dev
if [ "${{ github.event_name }}" = "schedule" ]; then
DOCKER_VERSION=nightly
TAGS="${DOCKER_IMAGE}:${DOCKER_VERSION},ghcr.io/${DOCKER_IMAGE}:${DOCKER_VERSION}"
elif [[ $GITHUB_REF == refs/tags/* ]]; then
DOCKER_VERSION=${GITHUB_REF#refs/tags/}
TAGS="${DOCKER_IMAGE}:${DOCKER_VERSION},ghcr.io/${DOCKER_IMAGE}:${DOCKER_VERSION},${DOCKER_IMAGE}:latest,ghcr.io/${DOCKER_IMAGE}:latest"
fi
TAGS="${DOCKER_IMAGE}:${DOCKER_VERSION}"
echo ::set-output name=version::${DOCKER_VERSION}
echo ::set-output name=tags::${TAGS}
echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
@ -41,6 +40,13 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.CR_PAT }}
- name: Build and push
uses: docker/build-push-action@v2
with: