Skip to content

Nigthly

Nigthly #753

Workflow file for this run

name: Nigthly
on:
schedule:
- cron: '0 0 * * *'
jobs:
cleanup:
runs-on: private
steps:
- name: Clear registry and unused images
shell: bash
run: |
set +e
k3d registry delete k3d-iff.localhost
docker system prune -a -f
call-build:
uses: IndustryFusion/DigitalTwin/.github/workflows/build.yaml@main
call-test:
uses: IndustryFusion/DigitalTwin/.github/workflows/k8s-tests.yaml@main
push-images:
needs: call-test
runs-on: private
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
SELF_HOSTED_RUNNER: true
steps:
- uses: actions/checkout@v4
- name: Push images
shell: bash
run: |
set +o pipefail
docker login -u "${DOCKER_USERNAME}" -p "${DOCKER_PASSWORD}"
# Export current docker tag (release version) as env variable DOCKER_TAG
export $(cat .env | xargs)
TARGET_DOCKER_TAG=nightly-`date -I`
# Tag and push passed "k3d-iff.localhost:12345:<image>:${DOCKER_TAG}" images as latest
images=$(docker images --format "{{.Repository}}:{{.Tag}}" | grep k3d-iff | grep ${DOCKER_TAG} )
for image in ${images}; do
newimage=$(echo $image | sed -r "s/:${DOCKER_TAG}/:latest/g" | sed -r "s/k3d-iff.localhost:12345\///g");
docker tag ${image} ${newimage};
docker push ${newimage};
newimage=$(echo $image | sed -r "s/:${DOCKER_TAG}/:${TARGET_DOCKER_TAG}/g" | sed -r "s/k3d-iff.localhost:12345\///g");
docker tag ${image} ${newimage};
docker push ${newimage};
done