diff --git a/.github/workflows/call-local-docker-build.yaml b/.github/workflows/call-local-docker-build.yaml index 939d990..9fd2958 100644 --- a/.github/workflows/call-local-docker-build.yaml +++ b/.github/workflows/call-local-docker-build.yaml @@ -8,12 +8,10 @@ on: push: branches: - main - # don't rebuild image if someone only edited unrelated files paths-ignore: - 'README.md' - '.github/linters/**' pull_request: - # don't rebuild image if someone only edited unrelated files paths-ignore: - 'README.md' - '.github/linters/**' @@ -27,57 +25,20 @@ jobs: permissions: contents: read - packages: write # needed to push docker image to ghcr.io - pull-requests: write # needed to create and update comments in PRs + packages: write + pull-requests: write secrets: - # Only needed if with:dockerhub-enable is true below dockerhub-username: ${{ secrets.DOCKERHUB_USERNAME }} - # Only needed if with:dockerhub-enable is true below dockerhub-token: ${{ secrets.DOCKERHUB_TOKEN }} with: - ### REQUIRED - ### ENABLE ONE OR BOTH REGISTRIES - ### tell docker where to push. - ### NOTE if Docker Hub is set to true, you must set secrets above and also add account/repo/tags below dockerhub-enable: true ghcr-enable: true - ### REQUIRED - ### A list of the account/repo names for docker build. List should match what's enabled above - ### defaults to: image-names: | ${{ github.repository }} ghcr.io/${{ github.repository }} - - ### REQUIRED set rules for tagging images, based on special action syntax: - ### https://github.com/docker/metadata-action#tags-input - ### defaults to: - tag-rules: | - type=raw,value=latest,enable=${{ endsWith(github.ref, github.event.repository.default_branch) }} - type=ref,event=pr - type=ref,event=branch - type=semver,pattern={{version}} - type=raw,value=gha-${{ github.run_id }} - - ### path to where docker should copy files into image - ### defaults to root of repository (.) - # context: . - - ### Dockerfile alternate name. Default is Dockerfile (relative to context path) - # file: Containerfile - - ### build stage to target, defaults to empty, which builds to last stage in Dockerfile - # target: - - ### platforms to build for, defaults to linux/amd64 - ### other options: linux/amd64,linux/arm64,linux/arm/v7 - # platforms: linux/amd64 - - ### Create a PR comment with image tags and labels - ### defaults to false - # comment-enable: false \ No newline at end of file diff --git a/.github/workflows/reusable-docker-build.yaml b/.github/workflows/reusable-docker-build.yaml index 42723a9..eb0d8ab 100644 --- a/.github/workflows/reusable-docker-build.yaml +++ b/.github/workflows/reusable-docker-build.yaml @@ -26,7 +26,7 @@ on: comment-enable: description: Create a PR comment with image tags and labels required: false - default: false + default: true type: boolean context: description: Docker context (path) to start build from @@ -47,11 +47,13 @@ on: type: string # common ones: linux/amd64,linux/arm64,linux/arm/v7 default: linux/amd64 - # TODO: does this work in calling repos? image-names: description: A list of the account/repo names for docker build - required: true + required: false type: string + default: | + ${{ github.repository }} + ghcr.io/${{ github.repository }} tag-rules: # https://github.com/marketplace/actions/docker-metadata-action#tags-input description: Use docker-metadata action to create tags from a key-value pair list in CSV format @@ -80,9 +82,6 @@ on: required: false outputs: - image-tags: - description: "all tags from docker build" - value: ${{ jobs.build-image.outputs.image-tags }} ghcr-tag: description: "single-use tag for ghcr.io" value: ${{ jobs.build-image.outputs.ghcr-tag }} @@ -105,8 +104,6 @@ jobs: runs-on: ubuntu-latest outputs: - # all tags from docker build - image-tags: ${{ steps.docker_meta.outputs.tags }} # only outputs the unique gha- image tag that's unique to each build ghcr-tag: ${{ steps.ghcr-tag.outputs.tag }} diff --git a/templates/call-docker-build.yaml b/templates/call-docker-build.yaml index 22ea777..c5ab733 100644 --- a/templates/call-docker-build.yaml +++ b/templates/call-docker-build.yaml @@ -30,11 +30,9 @@ jobs: secrets: - # Only needed if with:dockerhub-enable is true below - dockerhub-username: ${{ secrets.DOCKERHUB_USERNAME }} - # Only needed if with:dockerhub-enable is true below # https://hub.docker.com/settings/security + dockerhub-username: ${{ secrets.DOCKERHUB_USERNAME }} dockerhub-token: ${{ secrets.DOCKERHUB_TOKEN }} with: @@ -46,11 +44,11 @@ jobs: dockerhub-enable: true ghcr-enable: true - ### REQUIRED ### A list of the account/repo names for docker build. List should match what's enabled above ### defaults to: - image-names: | - ghcr.io/${{ github.repository }} + # image-names: | + # ${{ github.repository }} + # ghcr.io/${{ github.repository }} ### set rules for tagging images, based on special action syntax: ### https://github.com/docker/metadata-action#tags-input @@ -72,10 +70,11 @@ jobs: ### build stage to target, defaults to empty, which builds to last stage in Dockerfile # target: - ### platforms to build for, defaults to linux/amd64 + ### platforms to build for + ### defaults to linux/amd64 ### other options: linux/amd64,linux/arm64,linux/arm/v7 - # platforms: linux/amd64 + # platforms: linux/amd64,linux/arm64 ### Create a PR comment with image tags and labels - ### defaults to false + ### defaults to true # comment-enable: false