From 7141331474be6db05fa49bade9611b07e75e1b06 Mon Sep 17 00:00:00 2001 From: Paul Zehner Date: Mon, 4 Nov 2024 13:25:18 -0500 Subject: [PATCH] Use action to login to GHCR and use it for tests too --- .github/workflows/__build_base.yaml | 6 +++++- .github/workflows/build_test.yaml | 8 ++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/__build_base.yaml b/.github/workflows/__build_base.yaml index ac4bcc7..f5d730d 100644 --- a/.github/workflows/__build_base.yaml +++ b/.github/workflows/__build_base.yaml @@ -64,7 +64,11 @@ jobs: sudo apt-get install ./singularity-ce_${{ env.SINGULARITY_VERSION }}-jammy_amd64.deb - name: Login in GitHub Containers Repository with Docker - run: echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - name: Login in GitHub Containers Repository with Singularity run: echo ${{ secrets.GITHUB_TOKEN }} | singularity remote login -u ${{ github.actor }} --password-stdin oras://ghcr.io diff --git a/.github/workflows/build_test.yaml b/.github/workflows/build_test.yaml index a73fdad..9e36b5f 100644 --- a/.github/workflows/build_test.yaml +++ b/.github/workflows/build_test.yaml @@ -349,6 +349,14 @@ jobs: "echo ${{ secrets.GITHUB_TOKEN }} | singularity remote login -u ${{ github.actor }} --password-stdin oras://ghcr.io" if: ${{ matrix.backend.use_singularity }} + - name: Login in GitHub Containers Repository with Docker + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + if: ${{ ! matrix.backend.use_singularity }} + - name: Pull Singularity image # pulling the image in advance seems necessary as sometimes invoking `singularity run` on the image URL fails because it cannot find ghcr.io run: |