Files
ioBroker.docker/.github/workflows/docker_build_dev_image.yml
2021-08-28 13:06:27 +02:00

74 lines
2.7 KiB
YAML

# Github action to build Docker image from dev branch (tag: testing)
name: Build Docker image from dev
on:
workflow_dispatch:
push:
branches:
- dev
jobs:
bulid_dev:
runs-on: ubuntu-latest
steps:
- name: Checkout repo (dev)
uses: actions/checkout@v2.3.4
with:
repository: 'buanet/ioBroker.docker'
ref: 'dev'
- 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
sed -e "s/\${VERSION}/$VERSION-devbuild/" -e "s/\${DATI}/$DATI/" ./amd64/Dockerfile > ./amd64/Dockerfile.tmp
mv -f ./amd64/Dockerfile.tmp ./amd64/Dockerfile
sed -e "s/\${VERSION}/$VERSION-devbuild/" -e "s/\${DATI}/$DATI/" ./arm32v7/Dockerfile > ./arm32v7/Dockerfile.tmp
mv -f ./arm32v7/Dockerfile.tmp ./arm32v7/Dockerfile
sed -e "s/\${VERSION}/$VERSION-devbuild/" -e "s/\${DATI}/$DATI/" ./arm64v8/Dockerfile > ./arm64v8/Dockerfile.tmp
mv -f ./arm64v8/Dockerfile.tmp ./arm64v8/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
run: docker run --rm --privileged multiarch/qemu-user-static:register
- name: Login to DockerHub
uses: docker/login-action@v1.10.0
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASS }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v1.10.0
with:
registry: ghcr.io
username: ${{ secrets.PACKAGES_USER }}
password: ${{ secrets.PACKAGES_PASS }}
- name: Build an push Docker image (amd64)
run: |
echo "Building amd64..."
sed -i "s/\${VERSION}/devbuild/g" ./amd64/scripts/iobroker_startup.sh
docker build -t "buanet/iobroker:dev-amd64" ./amd64
docker tag "buanet/iobroker:dev-amd64" "iobroker/iobroker:dev-amd64"
echo "Done."
echo ''
echo "Pushing images to buanet/iobroker..."
docker push "buanet/iobroker:dev-amd64"
echo "Done."
echo ''