Bläddra i källkod

Publish Docker images to GitHub Container Registry

Frédéric Guillot 5 år sedan
förälder
incheckning
a37a2dd043
1 ändrade filer med 10 tillägg och 4 borttagningar
  1. 10 4
      .github/workflows/docker.yml

+ 10 - 4
.github/workflows/docker.yml

@@ -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: