Skip to content

Commit

Permalink
Only pushing if merge on main
Browse files Browse the repository at this point in the history
  • Loading branch information
ineiti committed Jul 3, 2024
1 parent f95d249 commit b7eddae
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ jobs:
build-docker:
name: Build D-Voting Docker images
runs-on: ubuntu-22.04
if: '! github.event.pull_request.draft'
env:
DockerTag: ${{ (github.ref == 'refs/heads/main') && 'latest' || github.head_ref }}
DockerTag: test
push: ${{ (github.ref == 'refs/heads/main') && 'true' || 'true' }}

steps:
- name: Checkout
Expand All @@ -26,10 +26,12 @@ jobs:
echo "REACT_APP_VERSION=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
echo "REACT_APP_BUILD=$(git describe --tags)" >> $GITHUB_ENV
echo "REACT_APP_BUILD_TIME=$(date)" >> $GITHUB_ENV
echo Pushing is ${{ env.push }}
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
- name: Login to GHCR
if: ${{ env.push == 'true' }}
uses: docker/login-action@v1
with:
registry: ghcr.io
Expand All @@ -46,21 +48,21 @@ jobs:
REACT_APP_VERSION
REACT_APP_BUILD
REACT_APP_BUILD_TIME
push: true
push: ${{ env.push }}
tags: ghcr.io/c4dt/d-voting-frontend:${{ env.DockerTag }}
- name: Build Backend
uses: docker/build-push-action@v2
with:
context: .
file: Dockerfiles/Dockerfile.backend
platforms: linux/amd64
push: true
push: ${{ env.push }}
tags: ghcr.io/c4dt/d-voting-backend:${{ env.DockerTag }}
- name: Build D-Voting
uses: docker/build-push-action@v2
with:
context: .
file: Dockerfiles/Dockerfile.dela
platforms: linux/amd64
push: true
push: ${{ env.push }}
tags: ghcr.io/c4dt/d-voting-dela:${{ env.DockerTag }}

0 comments on commit b7eddae

Please sign in to comment.