From b8d827a6a69c18f6116ff83303a3a8962306c7eb Mon Sep 17 00:00:00 2001 From: Khai Do <3697686+zaro0508@users.noreply.github.com> Date: Mon, 15 Jan 2024 11:41:43 -0800 Subject: [PATCH] fix deployment to dockerhub (#1415) * ci: unit tests broken, attempt fix by running setup python before install poetry * remove poetry cache * fix deployment to dockerhub The docker metadata action returns the branch (i.e. `master`) when a push occurs. That causes docker push to fail because there's not master tag in the registry. We need to change to make it push to `latest` tag in dockerhub registry. * fix dependency --- .github/workflows/main.yaml | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 8a4a9b2be..e2e9418fd 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -113,10 +113,32 @@ jobs: # - name: run tests # run: poetry run behave integration-tests/features --junit --junit-directory build/behave - docker-build-push: + docker-build-push-latest: needs: - docker-build - if: ${{ (github.ref == 'refs/heads/master') || (github.ref_type == 'tag') }} + if: ${{ github.ref == 'refs/heads/master' }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Log in to the Container registry + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: . + push: true + tags: latest + labels: ${{ steps.meta.outputs.labels }} + docker-build-push-tag: + needs: + - docker-build + if: ${{ github.ref_type == 'tag' }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -141,7 +163,7 @@ jobs: - packaging - documentation - unit-tests - - docker-build-push + - docker-build-push-tag # - integration-tests if: ${{ github.ref_type == 'tag' }} runs-on: ubuntu-latest