diff --git a/.github/workflows/docker-matrix-wheels.yml b/.github/workflows/docker-matrix-wheels.yml index f9e6080..8671453 100644 --- a/.github/workflows/docker-matrix-wheels.yml +++ b/.github/workflows/docker-matrix-wheels.yml @@ -187,17 +187,6 @@ jobs: run: | ./scripts/test-integration.sh ${{ steps.build-it.outputs.imageid }} - - name: Find image String - id: extract_image - run: | - echo "image_name=$(grep -m 1 '^FROM' Dockerfile | cut -d ' ' -f2 | cut -d ':' -f1)" >> $GITHUB_OUTPUT - echo "image_version=$(grep -m 1 '^FROM' Dockerfile | cut -d ' ' -f2 | cut -d ':' -f2)" >> $GITHUB_OUTPUT - - - name: Update docs - if: ${{ github.event_name == 'release' }} - run: | - sed -e "s/{FHEMPY_VERSION}/${{ needs.prepare_build.outputs.fhempyV }}/" -e "s/{PYTHON_VERSION}/${{ steps.extract_image.outputs.image_version}}/" -e "s/{DEBIAN_RELEASE}/buster/" -e s/{IMAGE_TAG}/${{ github.ref_name }}/ < README.tmpl > README.md - - name: Install cosign if: github.event_name == 'release' uses: sigstore/cosign-installer@v2.8.1 @@ -227,6 +216,8 @@ jobs: type=semver,pattern={{major}},enable=${{ github.event.release.prerelease == 0 }} type=ref,event=branch type=ref,event=pr + labels: | + org.opencontainers.image.title=${{ env.IMAGE_NAME }}_${{ matrix.module }} - name: Build and push Docker image for all plattforms uses: docker/build-push-action@v3.2.0 @@ -234,7 +225,7 @@ jobs: with: context: . platforms: linux/arm/v7,linux/amd64 - push: true # ${{ github.event_name == 'release' }} + push: ${{ github.event_name == 'release' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} target: runtime @@ -262,7 +253,45 @@ jobs: # This step uses the identity token to provision an ephemeral certificate # against the sigstore community Fulcio instance. run: echo "${{ steps.meta.outputs.tags }}" | xargs -I {} cosign sign {}@${{ steps.docker_build_runtime_cross.outputs.digest }} + + - name: Create Job Summary + run: | + echo "### Size report for commit: ${{ github.sha }}" >> $GITHUB_STEP_SUMMARY + echo "| Module | Image name |" >> $GITHUB_STEP_SUMMARY + echo "|-------|----------------------------------------------------------------------|" >> $GITHUB_STEP_SUMMARY + echo "| ${{ matrix.module }} | ${{ fromJSON(steps.docker_build_runtime_cross.outputs.metadata)['image.name'] }} |" >> $GITHUB_STEP_SUMMARY + echo "| ${{ matrix.module }} | ${{ fromJSON(steps.docker_build_runtime_cross.outputs.metadata)['image.name'] }} |" > matrix_result.md + + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: ${{ hashFiles('matrix_result.md') || 'none' }} + path: matrix_result.md + if-no-files-found: warn + + check-matrix: + runs-on: ubuntu-latest + needs: [buildImages,prepare_build] + permissions: + contents: write + steps: + - name: Checkout repository + uses: actions/checkout@v3 + - uses: actions/download-artifact@v3 + + + - name: Find image String + id: extract_image + run: | + echo "image_name=$(grep -m 1 '^FROM' Dockerfile | cut -d ' ' -f2 | cut -d ':' -f1)" >> $GITHUB_OUTPUT + echo "image_version=$(grep -m 1 '^FROM' Dockerfile | cut -d ' ' -f2 | cut -d ':' -f2)" >> $GITHUB_OUTPUT + + - name: Update docs (readme.md) + run: | + IMAGE_LIST="$(cat */matrix_result.md )" + sed -e "s/{MODULES_IMAGE_LIST}/$IMAGE_LIST/" -e "s/{FHEMPY_VERSION}/${{ needs.prepare_build.outputs.fhempyV }}/" -e "s/{PYTHON_VERSION}/${{ steps.extract_image.outputs.image_version}}/" -e "s/{DEBIAN_RELEASE}/buster/" -e s/{IMAGE_TAG}/${{ github.ref_name }}/ < README.tmpl > README.md + - name: git commit README.md id: commit if: ${{ github.event_name == 'release' }} @@ -277,4 +306,7 @@ jobs: with: token: ${{ secrets.BOT_PUSH_TOKEN }} branch: main - #unprotect_reviews: true + + - name: Set step summary + run: | + cat README.md >> $GITHUB_STEP_SUMMARY \ No newline at end of file diff --git a/README.tmpl b/README.tmpl index 55b2c4e..51b9dfe 100644 --- a/README.tmpl +++ b/README.tmpl @@ -1,14 +1,15 @@ # fhempy-docker -Docker Container with [fhempy](https://github.com/fhempy/fhempy) which can be connected to [FHEM](https://fhem.de/) +Docker Containers with [fhempy](https://github.com/fhempy/fhempy) which can be connected to [FHEM](https://fhem.de/) + +# Every image comes as a seperate image. +If you want two modules, you have to start two containers. -# Image with Perl core modules installed * Debian 11 {DEBIAN_RELEASE} * Python {PYTHON_VERSION} * fhempy {FHEMPY_VERSION} - # How to use with docker-compose Running fhempy in a docker environment is done by starting the container and connect it within the same network as your fhem container: @@ -18,9 +19,15 @@ Example is assuming, that your FHEM network is named `net` and already defined a fhempy: networks: - net - image: ghcr.io/fhem/fhempy-docker:{IMAGE_TAG} + image: ghcr.io/fhem/fhempy-docker-:{IMAGE_TAG} ``` To start your container right away: - docker run -d --name fhempy ghcr.io/fhem/fhempy-docker:{IMAGE_TAG} + docker run -d --name fhempy ghcr.io/fhem/fhempy-docker-:{IMAGE_TAG} + + +# Supported Modules and their image + +| Module | Image name | +{MODULES_IMAGE_LIST}