Skip to content

Commit

Permalink
ci: Run on push to main and workflow_dispatch (#3)
Browse files Browse the repository at this point in the history
* Allow for PRs to run build tests but don't deploy unless on main.
  If need to delploy on a non-main branch then use workflow_dispatch.
  • Loading branch information
matthewfeickert authored Nov 13, 2023
1 parent 2b1e097 commit ba4d986
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
name: Build AnalysisBase ML image

on:
push:
branches:
- "**"
- main
tags:
- "v*.*.*"
pull_request:
branches:
- main
workflow_dispatch:
repository_dispatch:
types: gitops-analysis-base-trigger

jobs:
docker:
runs-on: ubuntu-latest
Expand All @@ -21,7 +27,7 @@ jobs:
# list of Docker images to use as base name for tags
images: |
sslhep/analysis-dask-uc
hub.opensciencegrid.org/usatlas/analysis-dask-uc
hub.opensciencegrid.org/usatlas/analysis-dask-uc
# generate Docker tags based on the following events/attributes
tags: |
type=ref,event=branch
Expand All @@ -36,25 +42,38 @@ jobs:
uses: docker/[email protected]

- name: Login to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}


- name: Login to Harbor Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: hub.opensciencegrid.org
username: ${{ secrets.HARBOR_USERNAME }}
password: ${{ secrets.HARBOR_PASSWORD }}

- name: Test build
if: github.event_name == 'pull_request'
uses: docker/[email protected]
with:
context: .
file: Dockerfile
load: true
push: false
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- name: Build and push
if: github.event_name != 'pull_request'
uses: docker/[email protected]
with:
context: .
file: Dockerfile
push: true
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

Expand Down

0 comments on commit ba4d986

Please sign in to comment.