From f5e289b3a8e62f30c820e744035899f9d0642649 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Busse?= Date: Fri, 4 Oct 2024 23:55:29 +0200 Subject: [PATCH] CI: Add build and release --- .github/workflows/container-image.yml | 49 +++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .github/workflows/container-image.yml diff --git a/.github/workflows/container-image.yml b/.github/workflows/container-image.yml new file mode 100644 index 0000000..0206c68 --- /dev/null +++ b/.github/workflows/container-image.yml @@ -0,0 +1,49 @@ +name: Container Build and Release + +on: + push: + paths-ignore: + - '**.md' + branches: + - '**' + pull_request: + paths-ignore: + - '**.md' + workflow_dispatch: + +env: + ESPHOME_CFG: compost-0.yaml + +jobs: + build-release-container: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + ref: 'main' + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Build and push container to ghcr + id: docker_build + uses: docker/build-push-action@v6 + with: + build-args: ESPHOME_CFG=${{ env.ESPHOME_CFG }} + platforms: linux/amd64, linux/arm64 + push: true + file: Containerfile + tags: ghcr.io/bbusse/compost-sensor:latest + + - name: Image digest + run: echo ${{ steps.docker_build.outputs.digest }}