From 402365c394843a09f114574682ca5a2e3919cc37 Mon Sep 17 00:00:00 2001 From: Aisuko Date: Mon, 18 Mar 2024 22:53:37 +1100 Subject: [PATCH] Login to dockerhub Signed-off-by: Aisuko --- .github/workflows/ci-backend.yaml | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci-backend.yaml b/.github/workflows/ci-backend.yaml index f488dbf..210688b 100644 --- a/.github/workflows/ci-backend.yaml +++ b/.github/workflows/ci-backend.yaml @@ -28,7 +28,7 @@ jobs: - name: Check repository uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} cache: 'pip' @@ -57,7 +57,7 @@ jobs: - name: Check repository uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} cache: 'pip' @@ -183,7 +183,7 @@ jobs: - name: Check repository uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: '3.11' - name: Display Python version @@ -194,17 +194,15 @@ jobs: if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - name: Login to Github Container Registry uses: docker/login-action@v3 - # if: github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') && success() + if: github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') && success() with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Build Docker image if: startsWith(github.ref, 'refs/tags/') != true && success() run: | docker build -t ${{ secrets.DOCKER_REGISTRY }}/${{ secrets.IMAGE_NAME }}:${GITHUB_SHA::7} . - docker push ${{ secrets.DOCKER_REGISTRY }}/${{ secrets.IMAGE_NAME }}:${GITHUB_SHA::7} - name: Push Docker image if: github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') && success() run: | - docker push ghcr.io/${{ secrets.DOCKER_REGISTRY }}/${{ secrets.IMAGE_NAME }}:${GITHUB_SHA::7} + docker push ghcr.io/${{ secrets.DOCKER_REGISTRY }}/${{ secrets.IMAGE_NAME }}:${GITHUB_REF/refs\/tags\//}