From bf8bee23b84af08e86d39d73bbb3d9c3d33a0155 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Birrer?= <28423703+fugal-dy@users.noreply.github.com> Date: Wed, 8 Nov 2023 21:22:09 +0100 Subject: [PATCH] Create dev-image-ghcr.yml add dev-tagged image on push to main branch with dev-tools installed --- .github/workflows/dev-image-ghcr.yml | 66 ++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 .github/workflows/dev-image-ghcr.yml diff --git a/.github/workflows/dev-image-ghcr.yml b/.github/workflows/dev-image-ghcr.yml new file mode 100644 index 0000000..7c85c14 --- /dev/null +++ b/.github/workflows/dev-image-ghcr.yml @@ -0,0 +1,66 @@ +name: Publish version tagged image + +on: + # Run build for any PRs - we won't push in those however + pull_request: + branches: + - main + + # Publish `main` as Docker `dev` image. + push: + branches: + - main + +concurrency: + group: build-${{ github.ref }} + cancel-in-progress: true + +env: + IMAGE_NAME: projectcaluma/s3-hooked + REGISTRY: ghcr.io + +jobs: + # Push image to GitHub Packages. + # See also https://docs.docker.com/build/ci/github-actions/ + container-registry: + runs-on: ubuntu-latest + permissions: + packages: write + contents: read + + steps: + - uses: actions/checkout@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Log in to the Container registry + uses: docker/login-action@v2 + if: github.event_name != 'pull_request' + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v4 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=raw,value=dev,enable={{is_default_branch}} + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}} + + - name: Build and push + uses: docker/build-push-action@v4 + with: + context: . + file: ./Dockerfile + target: dev_image + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max