This commit is contained in:
buanet
2021-08-30 21:54:13 +02:00
parent 43cc2774d0
commit cf4fb97696
2 changed files with 64 additions and 53 deletions

View File

@@ -1,5 +1,5 @@
# Github action to build Docker image from dev branch (tag: dev)
name: Build image from dev
name: Build debian based image (dev-node14)
on:
workflow_dispatch:
@@ -8,7 +8,7 @@ on:
- dev
jobs:
bulid_dev:
bulid-dev-image:
runs-on: ubuntu-latest
steps:
- name: Checkout repo (dev)
@@ -29,21 +29,12 @@ jobs:
echo "majorversion=$MAJORVERSION" >> $GITHUB_ENV
echo "This is the Buildnumber/Timestamp: $DATI"
echo "dati=$DATI" >> $GITHUB_ENV
# startup script
sed -e "s/\${VERSION}/$VERSION-dev/" -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-dev/" -e "s/\${BUILD}/$DATI/" ./amd64/scripts/iobroker_startup.sh > ./amd64/scripts/iobroker_startup.tmp
mv -f ./amd64/scripts/iobroker_startup.tmp ./amd64/scripts/iobroker_startup.sh
sed -e "s/\${VERSION}/$VERSION-dev/" -e "s/\${DATI}/$DATI/" ./amd64/Dockerfile > ./amd64/Dockerfile.tmp
mv -f ./amd64/Dockerfile.tmp ./amd64/Dockerfile
# arm32v7
sed -e "s/\${VERSION}/$VERSION-dev/" -e "s/\${BUILD}/$DATI/" ./arm32v7/scripts/iobroker_startup.sh > ./arm32v7/scripts/iobroker_startup.tmp
mv -f ./arm32v7/scripts/iobroker_startup.tmp ./arm32v7/scripts/iobroker_startup.sh
sed -e "s/\${VERSION}/$VERSION-dev/" -e "s/\${DATI}/$DATI/" ./arm32v7/Dockerfile > ./arm32v7/Dockerfile.tmp
mv -f ./arm32v7/Dockerfile.tmp ./arm32v7/Dockerfile
# arm64v8
sed -e "s/\${VERSION}/$VERSION-dev/" -e "s/\${BUILD}/$DATI/" ./arm64v8/scripts/iobroker_startup.sh > ./arm64v8/scripts/iobroker_startup.tmp
mv -f ./arm64v8/scripts/iobroker_startup.tmp ./arm64v8/scripts/iobroker_startup.sh
sed -e "s/\${VERSION}/$VERSION-dev/" -e "s/\${DATI}/$DATI/" ./arm64v8/Dockerfile > ./arm64v8/Dockerfile.tmp
mv -f ./arm64v8/Dockerfile.tmp ./arm64v8/Dockerfile
sed -e "s/\${VERSION}/$VERSION-dev/" -e "s/\${DATI}/$DATI/" ./debian/node14/Dockerfile > ./debian/node14/Dockerfile.tmp
mv -f ./debian/node14/Dockerfile.tmp ./debian/node14/Dockerfile
- name: Set up manifest tool
run: |
@@ -70,45 +61,45 @@ jobs:
username: ${{ secrets.PACKAGES_USER }}
password: ${{ secrets.PACKAGES_PASS }}
- name: Build Docker image (amd64)
- name: Build Docker image (node14-amd64)
uses: docker/build-push-action@v2.6.1
with:
context: ./amd64
file: ./amd64/Dockerfile
context: ./debian
file: ./debian/node14/Dockerfile
push: true
platforms: linux/amd64
tags: |
buanet/iobroker:dev-amd64,
ghcr.io/buanet/iobroker:dev-amd64
buanet/iobroker:dev-node14-amd64,
ghcr.io/buanet/iobroker:dev-node14-amd64
- name: Build Docker image (armv32v7)
- name: Build Docker image (node14-arm32v7)
uses: docker/build-push-action@v2.6.1
with:
context: ./arm32v7
file: ./arm32v7/Dockerfile
context: ./debian
file: ./debian/node14/Dockerfile
push: true
platforms: linux/arm/v7
tags: |
buanet/iobroker:dev-arm32v7,
ghcr.io/buanet/iobroker:dev-arm32v7
buanet/iobroker:dev-node14-arm32v7,
ghcr.io/buanet/iobroker:dev-node14-arm32v7
- name: Build Docker image (arm64v8)
- name: Build Docker image (node14-arm64v8)
uses: docker/build-push-action@v2.6.1
with:
context: ./arm64v8
file: ./arm64v8/Dockerfile
context: ./debian
file: ./debian/node14/Dockerfile
push: true
platforms: linux/arm64
platforms: linux/arm64/v8
tags: |
buanet/iobroker:dev-arm64v8,
ghcr.io/buanet/iobroker:dev-arm64v8
buanet/iobroker:dev-node14-arm64v8,
ghcr.io/buanet/iobroker:dev-node14-arm64v8
- name: Create and push manifests
run: |
sed -e "s/\${VERSION}/dev/g" -e "s/\${DOCKERTAG}/dev/g" ./manifest.yml > manifest_dev.yaml
./manifest-tool --username ${{ secrets.DOCKER_USER }} --password ${{ secrets.DOCKER_PASS }} push from-spec manifest_dev.yaml
sed -e "s/\${VERSION}/dev/g" -e "s/\${DOCKERTAG}/dev/g" ./manifest_ghcr.yml > manifest_ghcr_dev.yaml
./manifest-tool --username ${{ secrets.PACKAGES_USER }} --password ${{ secrets.PACKAGES_PASS }} push from-spec manifest_ghcr_dev.yaml
sed -e "s/\${VERSION}/dev-node14/g" -e "s/\${DOCKERTAG}/dev-node14/g" ./manifest.yml > manifest_dev-node14.yaml
./manifest-tool --username ${{ secrets.DOCKER_USER }} --password ${{ secrets.DOCKER_PASS }} push from-spec manifest_dev-node14.yaml
sed -e "s/\${VERSION}/dev-node14/g" -e "s/\${DOCKERTAG}/dev-node14/g" ./manifest_ghcr.yml > manifest_ghcr_dev-node14.yaml
./manifest-tool --username ${{ secrets.PACKAGES_USER }} --password ${{ secrets.PACKAGES_PASS }} push from-spec manifest_ghcr_dev-node14.yaml
- name: Delete untagged images from GitHub packages
uses: actions/github-script@v3

View File

@@ -5,6 +5,7 @@
############################
autoconfirm=no # yould be set to true by commandline option
switch=none
####################################
@@ -14,8 +15,9 @@ autoconfirm=no # yould be set to true by commandline option
# display help text
display_help() {
echo "This script is build to manage your ioBroker container!"
echo "Usage: maintenance [ COMMAND ] [ OPTIONS ]"
echo " maint [ COMMAND ] [ OPTIONS ]"
echo ''
echo "Usage: maintenance [ COMMAND ] [ OPTION ]"
echo " maint [ COMMAND ] [ OPTION ]"
echo ''
echo "COMMANDS"
echo "------------------"
@@ -23,11 +25,12 @@ display_help() {
echo " on > switches mantenance mode ON"
echo " off > switches mantenance mode OFF and shuts down/ restarts container"
echo " upgrade > will put container to maintenance mode and upgrade iobroker"
echo " help > shows this help"
echo ''
echo "OPTIONS"
echo "------------------"
echo " -h|--help > shows this help"
echo " -y|--yes > confirms the used command without asking"
echo " -h|--help > shows this help"
echo ''
exit 0
}
@@ -129,37 +132,54 @@ upgrade() {
fi
}
##############################
##### parsing parameters #####
##############################
########################################
##### parsing commands and options #####
########################################
while :; do
case $1 in
-h|--help)
# reading all arguments and putting them in reverse
reverse=
for i in "$@"; do
reverse="$i $reverse"
done
# checking the arguments
for i in $reverse; do
case $i in
help|-h|--help)
display_help # calling function to display help text
exit
;;
-y|--yes)
autoconfirm=yes # answers prompts with "yes"
;;
status)
check_status # calling function to check maintenance mode status
;;
on|-on)
on)
switch_on # calling function to switch maintenance mode on
exit
;;
off)
switch_off # calling function to switch maintenance mode off
;;
upgrade)
upgrade # calling function to upgrade js-controller
;;
-y|--yes)
autoconfirm=yes # setting autoconfrm option to "yes"
;;
-a=*|--argument=*) # dummy exaple for parsing option with value
ARGUMENT="${i#*=}"
shift
;;
--) # End of all options.
shift
break
;;
-?*)
printf 'WARN: Unknown option (ignored): %s\n' "$1"
-?*|?*)
echo 'WARN: Unknown parameter. Please try again or see help (-h|--help).'
break
;;
*) # Default case: No more options, so break out of the loop.
break
;;
esac
shift
done
exit 0