mirror of
https://github.com/buanet/ioBroker.docker.git
synced 2025-12-18 02:49:01 +02:00
Bumps [actions/checkout](https://github.com/actions/checkout) from 2.3.4 to 2.4.0. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v2.3.4...v2.4.0) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
123 lines
4.6 KiB
YAML
123 lines
4.6 KiB
YAML
# Github action to build Docker image from dev branch (tag: dev)
|
|
name: Build debian based image (dev)
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
branches:
|
|
- dev
|
|
|
|
jobs:
|
|
bulid-dev-image:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repo (dev)
|
|
uses: actions/checkout@v2.4.0
|
|
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
|
|
# 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/\${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.6.0
|
|
|
|
- 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 Docker image (amd64)
|
|
uses: docker/build-push-action@v2.7.0
|
|
with:
|
|
context: ./debian
|
|
file: ./debian/node12/Dockerfile
|
|
push: true
|
|
platforms: linux/amd64
|
|
tags: |
|
|
buanet/iobroker:dev-amd64,
|
|
ghcr.io/buanet/iobroker:dev-amd64
|
|
|
|
- name: Build Docker image (arm32v7)
|
|
uses: docker/build-push-action@v2.7.0
|
|
with:
|
|
context: ./debian
|
|
file: ./debian/node12/Dockerfile
|
|
push: true
|
|
platforms: linux/arm/v7
|
|
tags: |
|
|
buanet/iobroker:dev-arm32v7,
|
|
ghcr.io/buanet/iobroker:dev-arm32v7
|
|
|
|
- name: Build Docker image (arm64v8)
|
|
uses: docker/build-push-action@v2.7.0
|
|
with:
|
|
context: ./debian
|
|
file: ./debian/node12/Dockerfile
|
|
push: true
|
|
platforms: linux/arm64/v8
|
|
tags: |
|
|
buanet/iobroker:dev-arm64v8,
|
|
ghcr.io/buanet/iobroker:dev-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
|
|
|
|
- name: Delete untagged images from GitHub packages
|
|
uses: actions/github-script@v5
|
|
with:
|
|
github-token: ${{ secrets.PACKAGES_PASS }}
|
|
script: |
|
|
const response = await github.request("GET /users/${{ env.OWNER }}/packages/container/${{ env.PACKAGE_NAME }}/versions",
|
|
{ per_page: ${{ env.PER_PAGE }}
|
|
});
|
|
for(version of response.data) {
|
|
if (version.metadata.container.tags.length == 0) {
|
|
console.log("delete " + version.id)
|
|
const deleteResponse = await github.request("DELETE /user/packages/container/${{ env.PACKAGE_NAME }}/versions/" + version.id, { });
|
|
console.log("status " + deleteResponse.status)
|
|
}
|
|
}
|
|
env:
|
|
OWNER: buanet
|
|
PACKAGE_NAME: iobroker
|
|
PER_PAGE: 100
|