From edd9c5ec519dc6de1dc8905bfac781ff2bfeefda Mon Sep 17 00:00:00 2001 From: buanet Date: Tue, 21 Sep 2021 19:33:03 +0200 Subject: [PATCH] add github action --- .github/workflows/build-debian-image-main.yml | 4 +- .../workflows/build-debian-image-main_iob.yml | 96 +++++++++++++++++++ manifest_iob.yml | 19 ++++ 3 files changed, 117 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/build-debian-image-main_iob.yml create mode 100644 manifest_iob.yml diff --git a/.github/workflows/build-debian-image-main.yml b/.github/workflows/build-debian-image-main.yml index cba55503..783059a1 100644 --- a/.github/workflows/build-debian-image-main.yml +++ b/.github/workflows/build-debian-image-main.yml @@ -50,7 +50,7 @@ jobs: id: buildx uses: docker/setup-buildx-action@v1.5.1 - - name: Login to DockerHub + - name: Login to DockerHub (buanet) uses: docker/login-action@v1.10.0 with: username: ${{ secrets.DOCKER_USER }} @@ -96,7 +96,7 @@ jobs: buanet/iobroker:${{ env.version }}-arm64v8, ghcr.io/buanet/iobroker:${{ env.version }}-arm64v8 - - name: Create and push manifests + - name: Create and push manifests (buanet) run: | sed -e "s/\${VERSION}/${{ env.version }}/g" -e "s/\${DOCKERTAG}/latest/g" ./manifest.yml > manifest_latest.yaml ./manifest-tool --username ${{ secrets.DOCKER_USER }} --password ${{ secrets.DOCKER_PASS }} push from-spec manifest_latest.yaml diff --git a/.github/workflows/build-debian-image-main_iob.yml b/.github/workflows/build-debian-image-main_iob.yml new file mode 100644 index 00000000..ed4edba6 --- /dev/null +++ b/.github/workflows/build-debian-image-main_iob.yml @@ -0,0 +1,96 @@ +# Github action to build Docker image from main branch for iobroker/iobroker (tag: latest) +name: Build debian based image (latest) + +on: + workflow_dispatch: + release: + types: + - published + schedule: + - cron: '42 3 * * 5' + +jobs: + bulid-latest-image: + runs-on: ubuntu-latest + steps: + - name: Checkout repo (main) + uses: actions/checkout@v2.3.4 + with: + repository: 'buanet/ioBroker.docker' + ref: 'main' + + - name: Get and write version and date + id: version + run: | + VERSION="$(cat .VERSION)" + MAJORVERSION="$(cat .VERSION | cut -c 1-2 | sed -r 's#^(.{0})#\1latest-#')" + DATI="$(date --rfc-3339=seconds | sed 's/ /T/')" + echo "This is the Version: $VERSION" + echo "version=$VERSION" >> $GITHUB_ENV + echo "This is the Major Version: $MAJORVERSION" + echo "majorversion=$MAJORVERSION" >> $GITHUB_ENV + echo "This is the Buildnumber/Timestamp: $DATI" + echo "dati=$DATI" >> $GITHUB_ENV + # startup script + sed -e "s/\${VERSION}/$VERSION/" -e "s/\${BUILD}/$DATI/" ./debian/scripts/iobroker_startup.sh > ./debian/scripts/iobroker_startup.tmp + mv -f ./debian/scripts/iobroker_startup.tmp ./debian/scripts/iobroker_startup.sh + # amd64 + sed -e "s/\${VERSION}/$VERSION/" -e "s/\${DATI}/$DATI/" ./debian/node12/Dockerfile > ./debian/node12/Dockerfile.tmp + mv -f ./debian/node12/Dockerfile.tmp ./debian/node12/Dockerfile + + - name: Set up manifest tool + run: | + wget https://github.com/estesp/manifest-tool/releases/download/v0.7.0/manifest-tool-linux-amd64 -O manifest-tool + chmod +x manifest-tool + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1.2.0 + + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v1.5.1 + + - name: Login to DockerHub (iobroker) + uses: docker/login-action@v1.10.0 + with: + username: ${{ secrets.DOCKER_USER_IOB }} + password: ${{ secrets.DOCKER_PASS_IOB }} + + - name: Build Docker image (amd64) + uses: docker/build-push-action@v2.6.1 + with: + context: ./debian + file: ./debian/node12/Dockerfile + push: true + platforms: linux/amd64 + tags: | + iobroker/iobroker:${{ env.version }}-amd64, + + - name: Build Docker image (arm32v7) + uses: docker/build-push-action@v2.6.1 + with: + context: ./debian + file: ./debian/node12/Dockerfile + push: true + platforms: linux/arm/v7 + tags: | + iobroker/iobroker:${{ env.version }}-arm32v7, + + - name: Build Docker image (arm64v8) + uses: docker/build-push-action@v2.6.1 + with: + context: ./debian + file: ./debian/node12/Dockerfile + push: true + platforms: linux/arm64/v8 + tags: | + iobroker/iobroker:${{ env.version }}-arm64v8, + + - name: Create and push manifests (iobroker) + run: | + sed -e "s/\${VERSION}/${{ env.version }}/g" -e "s/\${DOCKERTAG}/latest/g" ./manifest_iob.yml > manifest_latest_iob.yaml + ./manifest-tool --username ${{ secrets.DOCKER_USER_IOB }} --password ${{ secrets.DOCKER_PASS_IOB }} push from-spec manifest_latest_iob.yaml + sed -e "s/\${VERSION}/${{ env.version }}/g" -e "s/\${DOCKERTAG}/${{ env.majorversion }}/g" ./manifest_iob.yml > manifest_majorversion_iob.yaml + ./manifest-tool --username ${{ secrets.DOCKER_USER_IOB }} --password ${{ secrets.DOCKER_PASS_IOB }} push from-spec manifest_majorversion_iob.yaml + sed -e "s/\${VERSION}/${{ env.version }}/g" -e "s/\${DOCKERTAG}/${{ env.version }}/g" ./manifest_iob.yml > manifest_version_iob.yaml + ./manifest-tool --username ${{ secrets.DOCKER_USER_IOB }} --password ${{ secrets.DOCKER_PASS_IOB }} push from-spec manifest_version_iob.yaml diff --git a/manifest_iob.yml b/manifest_iob.yml new file mode 100644 index 00000000..80ddb534 --- /dev/null +++ b/manifest_iob.yml @@ -0,0 +1,19 @@ +image: iobroker/iobroker:${DOCKERTAG} +manifests: + - + image: iobroker/iobroker:${VERSION}-amd64 + platform: + architecture: amd64 + os: linux + - + image: iobroker/iobroker:${VERSION}-arm64v8 + platform: + architecture: arm64 + variant: v8 + os: linux + - + image: iobroker/iobroker:${VERSION}-arm32v7 + platform: + architecture: arm + variant: v7 + os: linux