Skip to content

chore: update Cargo.lock #41

chore: update Cargo.lock

chore: update Cargo.lock #41

Workflow file for this run

name: Build and Push Docker Image
on:
push:
tags:
- "v*"
workflow_dispatch:
# Cancel any in-flight publish for the same ref. A retag (e.g. force-pushing
# a tag) would otherwise race and produce a half-published manifest list.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
env:
GHCR_REGISTRY: ghcr.io
GHCR_IMAGE: ${{ github.repository }}
# Docker Hub mirror is optional. Set the DOCKERHUB_USERNAME secret
# (workflow falls back to the GitHub actor name if unset) and the
# DOCKERHUB_TOKEN secret to enable the Docker Hub side of the publish.
DOCKERHUB_IMAGE: ${{ vars.DOCKERHUB_IMAGE || github.repository }}
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
# QEMU lets buildx emulate linux/arm64 on linux/amd64 runners.
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ${{ env.GHCR_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Docker Hub login is gated on DOCKERHUB_TOKEN being set. Repos that
# haven't configured the secret still get a working GHCR-only build.
- name: Detect Docker Hub credentials
id: dockerhub
shell: bash
run: |
if [ -n "${{ secrets.DOCKERHUB_TOKEN }}" ]; then
echo "enabled=true" >> "$GITHUB_OUTPUT"
else
echo "enabled=false" >> "$GITHUB_OUTPUT"
echo "::notice::DOCKERHUB_TOKEN not set; Docker Hub publish skipped"
fi
- name: Log in to Docker Hub
if: steps.dockerhub.outputs.enabled == 'true'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME || github.actor }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
# Tag the manifest list at both registries simultaneously when
# Docker Hub creds are available; otherwise just GHCR.
images: |
${{ env.GHCR_REGISTRY }}/${{ env.GHCR_IMAGE }}
${{ steps.dockerhub.outputs.enabled == 'true' && env.DOCKERHUB_IMAGE || '' }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=raw,value=latest,enable={{is_default_branch}}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=${{ env.GHCR_REGISTRY }}/${{ env.GHCR_IMAGE }}:buildcache
cache-to: type=registry,ref=${{ env.GHCR_REGISTRY }}/${{ env.GHCR_IMAGE }}:buildcache,mode=max
# Apple-silicon users via Docker Desktop pulled the x86_64 image
# under emulation pre-0.1.4. Native arm64 added to match upstream
# decolua/9router's multi-arch manifest.
platforms: linux/amd64,linux/arm64
provenance: false
sbom: false