Push Docker images to GitHub container registry

This commit is contained in:
Frédéric Guillot 2020-10-27 20:01:00 -07:00
parent 7abb6d6b42
commit 79ccb7a2b0
1 changed files with 11 additions and 3 deletions

View File

@ -16,16 +16,17 @@ jobs:
id: docker_tag
run: |
SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-8`
APP_VERSION="master.${SHORT_SHA}"
DOCKER_IMAGE=kanboard/kanboard
DOCKER_VERSION=dev
APP_VERSION="master.${SHORT_SHA}"
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/}
APP_VERSION=$DOCKER_VERSION
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::${APP_VERSION}
echo ::set-output name=tags::${TAGS}
echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
@ -42,6 +43,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: