add github action

This commit is contained in:
buanet
2021-09-21 19:33:03 +02:00
parent 07d15bcf20
commit edd9c5ec51
3 changed files with 117 additions and 2 deletions

View File

@@ -50,7 +50,7 @@ jobs:
id: buildx id: buildx
uses: docker/setup-buildx-action@v1.5.1 uses: docker/setup-buildx-action@v1.5.1
- name: Login to DockerHub - name: Login to DockerHub (buanet)
uses: docker/login-action@v1.10.0 uses: docker/login-action@v1.10.0
with: with:
username: ${{ secrets.DOCKER_USER }} username: ${{ secrets.DOCKER_USER }}
@@ -96,7 +96,7 @@ jobs:
buanet/iobroker:${{ env.version }}-arm64v8, buanet/iobroker:${{ env.version }}-arm64v8,
ghcr.io/buanet/iobroker:${{ env.version }}-arm64v8 ghcr.io/buanet/iobroker:${{ env.version }}-arm64v8
- name: Create and push manifests - name: Create and push manifests (buanet)
run: | run: |
sed -e "s/\${VERSION}/${{ env.version }}/g" -e "s/\${DOCKERTAG}/latest/g" ./manifest.yml > manifest_latest.yaml 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 ./manifest-tool --username ${{ secrets.DOCKER_USER }} --password ${{ secrets.DOCKER_PASS }} push from-spec manifest_latest.yaml

View File

@@ -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

19
manifest_iob.yml Normal file
View File

@@ -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