github actions test

This commit is contained in:
buanet
2021-08-28 13:29:37 +02:00
parent 7b1d444e5a
commit ef3a160a7c
2 changed files with 66 additions and 19 deletions

View File

@@ -1,4 +1,4 @@
# Github action to build Docker image from dev branch (tag: testing)
# Github action to build Docker image from dev branch (tag: dev)
name: Build Docker image from dev
@@ -7,7 +7,7 @@ on:
push:
branches:
- dev
jobs:
bulid_dev:
runs-on: ubuntu-latest
@@ -17,7 +17,7 @@ jobs:
with:
repository: 'buanet/ioBroker.docker'
ref: 'dev'
- name: Get and write version and date
id: version
run: |
@@ -45,12 +45,16 @@ jobs:
- name: Set up QEMU
run: docker run --rm --privileged multiarch/qemu-user-static:register
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1.3.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:
@@ -58,16 +62,62 @@ jobs:
username: ${{ secrets.PACKAGES_USER }}
password: ${{ secrets.PACKAGES_PASS }}
- name: Build an push Docker image (amd64)
- name: Build Docker image (amd64)
uses: docker/build-push-action@v2.6.1
with:
context: ./amd64
file: ./amd64/Dockerfile
push: true
platforms: linux/amd64
tags: |
buanet/iobroker:dev-amd64,
ghcr.io/buanet/iobroker:dev-amd64
- name: Build Docker image (armv32v7)
uses: docker/build-push-action@v2.6.1
with:
context: ./arm32v7
file: ./arm32v7/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.6.1
with:
context: ./arm64v8
file: ./arm64v8/Dockerfile
push: true
platforms: linux/arm64
tags: |
buanet/iobroker:dev-arm64v8,
ghcr.io/buanet/iobroker:dev-arm64v8
- name: Create and push manifests
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 ''
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@v3
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

View File

@@ -35,9 +35,6 @@ RUN curl -sL https://deb.nodesource.com/setup_12.x | bash \
&& apt-get update && apt-get install -y nodejs \
&& rm -rf /var/lib/apt/lists/*
# Testing
RUN cat /proc/self/cgroup
# Generating locales
RUN sed -i 's/^# *\(de_DE.UTF-8\)/\1/' /etc/locale.gen \
&& sed -i 's/^# *\(en_US.UTF-8\)/\1/' /etc/locale.gen \