mirror of
https://github.com/iamlukethedev/Claw3D.git
synced 2026-07-30 19:22:28 +00:00
* Added docker-ignore * ops(docker): publish Claw3D images from main. Add a GHCR publishing workflow and expose a health endpoint so Fly deployments can build and pass runtime health checks. Made-with: Cursor * ops(docker): publish branch preview images. Tag non-main branch builds with the branch name so test deployments can use GHCR images before merging to main. Made-with: Cursor --------- Co-authored-by: iamlukethedev <iamlukethedev@users.noreply.github.com> Co-authored-by: iamlukethedev <lucas.guilherme@smartwayslfl.com>
67 lines
1.8 KiB
YAML
67 lines
1.8 KiB
YAML
name: Docker Publish
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- "**"
|
|
tags:
|
|
- "v*"
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
REGISTRY: ghcr.io
|
|
IMAGE_NAME: ghcr.io/${{ github.repository_owner }}/claw3d
|
|
|
|
jobs:
|
|
publish:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Log in to GitHub Container Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ${{ env.REGISTRY }}
|
|
username: ${{ github.repository_owner }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Prepare Docker tags
|
|
id: tags
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
tags=()
|
|
ref_name="$(printf '%s' "${GITHUB_REF_NAME}" | tr '[:upper:]' '[:lower:]' | tr '/_' '-' | tr -cd 'a-z0-9.-')"
|
|
if [[ "${GITHUB_REF}" == "refs/heads/main" ]]; then
|
|
tags+=("${IMAGE_NAME}:main")
|
|
elif [[ "${GITHUB_REF}" == refs/heads/* ]]; then
|
|
tags+=("${IMAGE_NAME}:${ref_name}")
|
|
fi
|
|
if [[ "${GITHUB_REF}" == refs/tags/v* ]]; then
|
|
version="${GITHUB_REF#refs/tags/v}"
|
|
tags+=("${IMAGE_NAME}:${version}")
|
|
tags+=("${IMAGE_NAME}:latest")
|
|
fi
|
|
{
|
|
echo "value<<EOF"
|
|
printf "%s\n" "${tags[@]}"
|
|
echo "EOF"
|
|
} >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Build and push image
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
push: true
|
|
platforms: linux/amd64,linux/arm64
|
|
tags: ${{ steps.tags.outputs.value }}
|
|
cache-from: type=gha
|
|
cache-to: type=gha,mode=max
|