name: Nightly Docker # Publishes evcc/evcc:nightly from master. Called by the scheduled nightly build # and by the /nightly command. on: workflow_call: jobs: docker: name: Publish Docker :nightly runs-on: depot-ubuntu-24.04-arm permissions: contents: read steps: - uses: actions/checkout@v7 with: ref: refs/heads/master # force master fetch-depth: 0 persist-credentials: false - name: Login uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4 with: username: ${{ secrets.DOCKER_USER }} password: ${{ secrets.DOCKER_PASS }} - name: Setup Buildx id: buildx uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4 - name: Restore build cache uses: ./.github/actions/docker-cache with: builder: ${{ steps.buildx.outputs.name }} - name: Define tags id: meta uses: docker/metadata-action@80c7e94dd9b9319bd5eb7a0e0fe9291e23a2a2e9 # v6 with: images: evcc/evcc tags: | type=raw,value=nightly type=raw,value=nightly.{{date 'YYYYMMDD'}}-{{sha}} - name: Publish uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v7 with: context: . platforms: linux/amd64,linux/arm64,linux/arm/v6 push: true tags: ${{ steps.meta.outputs.tags }} - name: Delete old nightly.* tags run: | old_tags=$(curl -s "https://hub.docker.com/v2/repositories/evcc/evcc/tags/?page_size=100" | jq -r '.results | map(select(.name | startswith("nightly."))) | sort_by(.last_updated) | reverse | .[1:] | .[].name') for tag in $old_tags; do echo "Deleting tag: $tag" curl -s -H "Authorization: Bearer ${{ secrets.DOCKER_PASS }}" -X DELETE "https://hub.docker.com/v2/repositories/evcc/evcc/tags/$tag/" done