From 9e7a75947c8a5faaee0cffae4584e05c6032aba4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Compagnon?= Date: Thu, 6 Oct 2022 13:00:10 +0200 Subject: [PATCH] Add a github workflow to auto-build packages --- .github/workflows/build-and-push.yaml | 85 +++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 .github/workflows/build-and-push.yaml diff --git a/.github/workflows/build-and-push.yaml b/.github/workflows/build-and-push.yaml new file mode 100644 index 0000000..0b30463 --- /dev/null +++ b/.github/workflows/build-and-push.yaml @@ -0,0 +1,85 @@ +--- +# template source: https://github.com/bretfisher/docker-build-workflow/blob/main/templates/call-docker-build.yaml +name: Docker Build + +on: + push: + branches: + - main + # don't rebuild image if someone only edited unrelated files + paths-ignore: + - 'README.md' + - 'LICENSE' + pull_request: + # don't rebuild image if someone only edited unrelated files + paths-ignore: + - 'README.md' + - 'LICENSE' + +jobs: + call-docker-build: + + name: Call Docker Build + + uses: bretfisher/docker-build-workflow/.github/workflows/reusable-docker-build.yaml@2f9fdc0325196df9f11bfe4263e277793e648922 + + permissions: + contents: read + packages: write # needed to push docker image to ghcr.io + pull-requests: write # needed to create and update comments in PRs + + secrets: + + # Only needed if with:dockerhub-enable is true below + # https://hub.docker.com/settings/security + dockerhub-username: "" + 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: false + ghcr-enable: true + + ### A list of the account/repo names for docker build. List should match what's enabled above + ### defaults to: + image-names: | + name=ghcr.io/${{ github.repository }} + # name=${{ github.repository }},enable=false + + ### 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=raw,value=stable-{{date 'YYYYMMDDHHmmss'}},enable=${{ endsWith(github.ref, github.event.repository.default_branch) }} + # type=ref,event=pr + # type=ref,event=branch + # 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,linux/arm64,linux/arm/v7,linux/arm/v6,linux/386 + + ### Create a PR comment with image tags and labels + ### defaults to true + # comment-enable: false + + # Additionals parameters + # (cf https://github.com/marketplace/actions/docker-metadata-action#flavor-input) + flavor-rules: | + latest=auto