Skip to content

Commit

Permalink
If Docker CI Changes, then Run the CI for Docker in PR
Browse files Browse the repository at this point in the history
  • Loading branch information
calvinp0 committed Feb 11, 2024
1 parent c2ead23 commit 2251086
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions .github/workflows/docker_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ on:
branches:
- main
paths:
- "./Dockerfile"
- "./.github/workflows/docker_build.yml"
- "Dockerfile"
- ".github/workflows/docker_build.yml"
pull_request:
branches:
- main
paths:
- "./Dockerfile"
- "./.github/workflows/docker_build.yml"
- "Dockerfile"
- ".github/workflows/docker_build.yml"
types: [opened, synchronize, reopened, ready_for_review, review_requested]

workflow_dispatch: # Add this line to enable manual trigger

jobs:
build:
Expand All @@ -25,11 +25,7 @@ jobs:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: false
# all of these default to true, but feel free to set to
# "false" if necessary for your workflow
android: true
dotnet: true
haskell: true
Expand All @@ -39,17 +35,14 @@ jobs:
- name: Checkout
uses: actions/checkout@v2

# Conditional step for building image without pushing, for PRs
- name: Build Docker Image (No Push)
# if condition is pull request or push then it will build the image
if: github.event_name == 'pull_request' || github.event_name == 'push'
uses: docker/[email protected]
with:
context: .
file: ./Dockerfile
push: false

# Conditional steps for building and pushing, for pushes to main
- name: Login to Docker Hub
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: docker/[email protected]
Expand Down

0 comments on commit 2251086

Please sign in to comment.