mirror of
https://github.com/nicolargo/glances.git
synced 2024-11-24 13:23:12 +03:00
ci: fix pushing for develop branch
This commit is contained in:
parent
31c13d889a
commit
353c2f5fdb
7
.github/workflows/main.yml
vendored
7
.github/workflows/main.yml
vendored
@ -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}}
|
||||
|
Loading…
Reference in New Issue
Block a user