From 39e2d4c73fc54030126a5aa5890f853529f09021 Mon Sep 17 00:00:00 2001 From: Edwin Betancourt Date: Thu, 16 Jun 2022 15:16:31 -0400 Subject: [PATCH] conditional to docker hub. --- .github/workflows/publish.yml | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 278d2439957..1f4d6edf198 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -79,11 +79,35 @@ jobs: with: args: 'Adempiere-Vue.zip' + # Check secrets to push image in docker hub registry + check-docker-secrets: + name: Check if docker hub registry information was set on secrets + needs: + - build-app + runs-on: ubuntu-latest + outputs: + is_have_secrets: ${{ steps.check_secret_job.outputs.have_secrets }} + steps: + - id: check_secret_job + run: | + if [[ "${{ secrets.DOCKER_REPO_FRONTEND }}" != "" && \ + "${{ secrets.DOCKER_USERNAME }}" != "" && \ + "${{ secrets.DOCKER_TOKEN }}" != "" ]]; \ + then + echo "Secrets to use a container registry were configured in the repo" + echo "::set-output name=is_have_secrets::true" + else + echo "Secrets to use a container registry were not configured in the repo" + echo "::set-output name=is_have_secrets::false" + fi + # Publish docker image in Docker Hub registry to application push-imame-dhr: name: Push Docker image to Docker Hub needs: - - build-app + - check-docker-secrets + # Skip step based on secret + if: needs.check-docker-secrets.outputs.is_have_secrets == 'true' runs-on: ubuntu-latest steps: - name: Check out the repo