evcc-io/.github/workflows/nightly-docker.yml
dependabot[bot] 0ade536a9c
Bump docker/login-action from 4.1.0 to 4.6.0 (#32360)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-08-01 12:07:04 +02:00

66 lines
2.1 KiB
YAML

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
actions: read
steps:
- uses: actions/checkout@v7
with:
ref: refs/heads/master # force master
fetch-depth: 0
persist-credentials: false
- name: Get dist from cache
uses: actions/cache/restore@v6
id: cache-dist
with:
path: dist
key: ${{ runner.os }}-${{ github.sha }}-dist
- name: Login
uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASS }}
- name: Setup Buildx
uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4
- 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 }}
cache-from: type=gha
cache-to: type=gha,mode=max
- 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