From 75039a3a426a833efb1dc5ef9b0a2df6fad53d84 Mon Sep 17 00:00:00 2001 From: Han Wang <92130845+wanghan-iapcm@users.noreply.github.com> Date: Fri, 29 Apr 2022 16:07:24 +0800 Subject: [PATCH] publish docker to github (#19) * publish to github docker * publish only on push to master Co-authored-by: Han Wang --- .github/workflows/pub-docker.yml | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pub-docker.yml b/.github/workflows/pub-docker.yml index 1f7afcce..f6d8b597 100644 --- a/.github/workflows/pub-docker.yml +++ b/.github/workflows/pub-docker.yml @@ -13,10 +13,13 @@ on: - 'master' jobs: - push_to_registry: + push_to_registries: if: github.repository_owner == 'deepmodeling' - name: Push Docker image to Docker Hub + name: Push Docker image to Docker Hub and ghcr runs-on: ubuntu-latest + permissions: + packages: write + contents: read steps: - name: Check out the repo uses: actions/checkout@v3 @@ -27,13 +30,22 @@ jobs: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} + - name: Log in to the Container registry + uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Extract metadata (tags, labels) for Docker id: meta uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 with: - images: dptechnology/dpgen2 + images: | + dptechnology/dpgen2 + ghcr.io/deepmodeling/dpgen2 - - name: Build and push Docker image + - name: Build and push Docker images uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc with: context: .