diff --git a/.github/workflows/build-deploy.yml b/.github/workflows/build-deploy.yml index 736c5ebc..2fad1d60 100644 --- a/.github/workflows/build-deploy.yml +++ b/.github/workflows/build-deploy.yml @@ -1,15 +1,14 @@ name: build-deploy-bay-images run-name: Build and deploy Bay images on: - schedule: - - cron: '23 20 * * 0' - workflow_dispatch: pull_request: - branches: - - '5.x' - pull_request_target: types: - closed + - opened + - synchronize + schedule: + - cron: '23 20 * * 0' + workflow_dispatch: env: REGISTRY: ghcr.io @@ -43,14 +42,14 @@ jobs: images: | ${{ env.REGISTRY }}/${{ github.repository }}/${{ matrix.images }} tags: | - type=ref,event=pr - type=ref,event=branch - type=raw,value={{github.event.pull_request.head.ref}},enable=${{ github.event.pull_request.merged == true }} + type=ref,event=pr,enable=${{ github.event.pull_request.merged == false }} + type=raw,value=${{ github.event.pull_request.base.ref }},enable=${{ github.event.pull_request.merged == true }} + type=ref,event=branch,enable=${{ contains(fromJson('["schedule", "workflow_dispatch"]'), github.event_name) }} labels: | maintainer=Digital Victoria repository=${{ github.repositoryUrl }} org.opencontainers.image.authors=Digital Victoria - org.opencontainers.image.source=https://github.com/${{ github.repository }}/tree/${{ github.ref_name }}/images/${{ matrix.images }}/Dockerfile + org.opencontainers.image.source=https://github.com/${{ github.repository }}/tree/${{ (contains(fromJson('["opened","synchronize"]'), github.event.action)) && github.head_ref || github.event.action == 'closed' && github.base_ref || github.ref_name }}/images/${{ matrix.images }}/Dockerfile org.opencontainers.image.title=${{ matrix.images }} org.opencontainers.image.description=${{ matrix.images }} image for Bay container platform @@ -62,5 +61,4 @@ jobs: ./gh-actions-bake.hcl ${{ steps.meta.outputs.bake-file }} # Target the default group - probably unnecessary. - # Target the default group - branchobably unnecessary. targets: ${{ matrix.images }} \ No newline at end of file diff --git a/README.md b/README.md index 6e0f347f..a370eb2e 100644 --- a/README.md +++ b/README.md @@ -75,12 +75,8 @@ Published images are scanned using Trivy and any CVEs identified are reported in ## Contribute [Open an issue](https://github.com/dpc-sdp/bay) on GitHub or submit a pull request with suggested changes. -### Development Builds -GitHub Actions is configured to automatically build images for pull requests that use the branch naming convention `build/`. This will generate the tag `build-`. - -For example - -`build/2.x-updated-cli` will generate the tag `build-2-x-updated-cli` and would be referenced as `ghcr.io/dpc-sdp/bay/:build-2-x-updated-cli`. +### Development builds +GitHub Actions is configured via the [build-deploy workflow](.github/workflows/build-deploy.yml) to build images for pull requests when they are opened and receive updates. These images are tagged with the PR number i.e. pr-86. ## Support [Digital Engagement, Department of Premier and Cabinet, Victoria, Australia](https://github.com/dpc-sdp)