name: Build on: push: branches: [main] schedule: # Weekly, so new Caddy and caddy-dns/desec releases land without a commit. - cron: "17 4 * * 1" workflow_dispatch: jobs: build-and-push: runs-on: ubuntu-latest container: image: docker:cli env: IMAGE: code.aneur.in/${{ gitea.repository }} steps: - name: Install Node (for checkout) run: apk add --no-cache nodejs - uses: actions/checkout@v4 - name: Build run: docker build --pull --tag "$IMAGE:latest" . - name: Check the deSEC module is built in run: docker run --rm "$IMAGE:latest" caddy list-modules | grep -x dns.providers.desec - name: Log in to the container registry env: BUILD_API_TOKEN: ${{ secrets.BUILD_API_TOKEN }} run: echo "$BUILD_API_TOKEN" | docker login code.aneur.in -u "${{ gitea.actor }}" --password-stdin - name: Promote current "latest" to "previous" run: | if docker buildx imagetools inspect "$IMAGE:latest" >/dev/null 2>&1; then docker buildx imagetools create -t "$IMAGE:previous" "$IMAGE:latest" else echo "No existing :latest to promote; skipping." fi - name: Push "latest" run: docker push "$IMAGE:latest"