diff options
-rw-r--r-- | .github/workflows/main.yml | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b775fe6f..c61a2a23 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -3,6 +3,7 @@ name: CI env: DEFAULT_DOCKER_IMAGE: nicolargo/glances NODE_ENV: ${{ (contains('refs/heads/master', github.ref) || startsWith(github.ref, 'refs/tags/v')) && 'prod' || 'dev' }} + PUSH_BRANCH: ${{ 'refs/heads/develop' == github.ref || 'refs/heads/master' == github.ref || startsWith(github.ref, 'refs/tags/v') }} DOCKER_PLATFORMS: linux/amd64,linux/arm/v7,linux/arm64,linux/386 on: @@ -32,7 +33,6 @@ jobs: env: DOCKER_IMAGE: ${{ secrets.DOCKER_IMAGE || env.DEFAULT_DOCKER_IMAGE }} DOCKERFILE: ${{ env.NODE_ENV == 'prod' && './docker-files/Dockerfile' || './docker-files/dev.Dockerfile' }} - PUSH_IMAGE: ${{ env.NODE_ENV == 'prod' && 'true' || 'false' }} run: | ls -la /tmp/.buildx-cache || true VERSION=latest @@ -47,7 +47,6 @@ jobs: echo "DOCKERFILE=${DOCKERFILE}" >> $GITHUB_ENV echo "VERSION=${VERSION}" >> $GITHUB_ENV - echo "PUSH_IMAGE=${PUSH_IMAGE}" >> $GITHUB_ENV echo "TAGS=${DOCKER_IMAGE}:${VERSION}" >> $GITHUB_ENV echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV echo "VCS_REF=${GITHUB_SHA::8}" >> $GITHUB_ENV @@ -65,7 +64,7 @@ jobs: - name: Login to DockerHub uses: docker/login-action@v1 - if: ${{env.PUSH_IMAGE == 'true'}} + if: ${{ env.PUSH_BRANCH == 'true' }} with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} @@ -73,7 +72,7 @@ jobs: - name: Build and push uses: docker/build-push-action@v2 with: - push: ${{env.PUSH_IMAGE == 'true'}} + push: ${{ env.PUSH_BRANCH == 'true' }} tags: ${{env.TAGS}} build-args: | VERSION=${{env.VERSION}} |