diff --git a/.github/workflows/CI.yaml b/.github/workflows/CI.yaml index e420ca4..3df1520 100644 --- a/.github/workflows/CI.yaml +++ b/.github/workflows/CI.yaml @@ -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 @@ -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 @@ -36,25 +42,38 @@ jobs: uses: docker/setup-buildx-action@v3.0.0 - name: Login to Docker Hub + if: github.event_name != 'pull_request' uses: docker/login-action@v3.0.0 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/build-push-action@v5.0.0 + 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/build-push-action@v5.0.0 with: context: . file: Dockerfile - push: true + push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }}