name: Publish Docker Image on: push: branches: [ "master" ] # Uncomment to also trigger on release tags: # tags: [ 'v*.*.*' ] env: REGISTRY_GHCR: ghcr.io IMAGE_NAME: ${{ github.repository }} jobs: build-and-push-image: runs-on: ubuntu-latest permissions: contents: read packages: write steps: - name: Checkout repository uses: actions/checkout@v4 - name: Set up QEMU (for multi-arch builds) uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Log in to GitHub Container Registry (GHCR) uses: docker/login-action@v3 with: registry: ${{ env.REGISTRY_GHCR }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Log in to Docker Hub uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Extract metadata (tags, labels) for Docker id: meta uses: docker/metadata-action@v5 with: images: | ${{ env.REGISTRY_GHCR }}/${{ env.IMAGE_NAME }} docker.io/${{ secrets.DOCKERHUB_USERNAME }}/velxio - name: Build and push Docker image uses: docker/build-push-action@v6 env: # v6 uploads a .dockerbuild provenance artifact per build with NO # expiry — 768 of them silently exhausted the account's Actions # artifact-storage quota (which then broke artifact uploads in # every other repo, e.g. qemu-lcgamboa's libqemu release CI). DOCKER_BUILD_RECORD_UPLOAD: "false" with: context: . file: Dockerfile.standalone platforms: linux/amd64,linux/arm64 push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} build-args: | ESPIDF_IMAGE=ghcr.io/davidmonterocrespo24/velxio-espidf-toolchain:latest VELXIO_LICENSE_KEY=${{ secrets.VELXIO_BUILD_LICENSE_KEY }} cache-from: type=gha # mode=min only stores the layers used in the final image. mode=max # also stores all intermediate layers, which doubles or triples the # cache footprint on a multi-stage build like ours (qemu-provider + # espidf-builder + frontend-builder + final stage). The 0.5 GB # Actions storage quota burns through fast with max; min is enough # to make incremental rebuilds fast on the layers that matter. cache-to: type=gha,mode=min - name: Ping search engines with sitemap if: success() run: | curl -s "https://www.google.com/ping?sitemap=https%3A%2F%2Fvelxio.dev%2Fsitemap.xml" -o /dev/null -w "Google ping: %{http_code}\n" curl -s "https://www.bing.com/ping?sitemap=https%3A%2F%2Fvelxio.dev%2Fsitemap.xml" -o /dev/null -w "Bing ping: %{http_code}\n" - name: Update Docker Hub description uses: peter-evans/dockerhub-description@v4 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} repository: ${{ secrets.DOCKERHUB_USERNAME }}/velxio short-description: "Local, open-source Arduino emulator — real AVR8 emulation, 48+ components, Monaco editor, arduino-cli backend." readme-filepath: ./README.md