Files
lit-examples/.github/workflows/deploy.yml
T
rodydavis b1446316da
Build and Deploy / build-and-deploy (push) Successful in 1m45s
ci: fix Docker image reference format and naming consistency
- Enforced lowercase for image owner and name to comply with Docker standards.
- Switched to using the package name from package.json as the image name.
- Added a unique tag using the commit SHA to improve deployment reliability.
2026-05-17 00:51:48 -07:00

77 lines
1.9 KiB
YAML

name: Build and Deploy
on:
push:
branches: ["main", "master"]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
REGISTRY: git.rodydavis.dev
jobs:
build-and-deploy:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9.7.1
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: 'pnpm'
- name: Set up Bazel (Bazelisk)
run: npm install -g @bazel/bazelisk
- name: Install dependencies
run: pnpm install --no-frozen-lockfile
- name: Verify Hermetic Bazel Build
run: bazel build //...
- name: Build Site
run: pnpm run build
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to registry
uses: docker/login-action@v4
with:
registry: ${{ env.REGISTRY }}
username: ${{ gitea.actor }}
password: ${{ secrets.GIT_TOKEN }}
- name: Get image metadata
id: meta
run: |
NAME=$(node -p "require('./package.json').name.toLowerCase()")
OWNER=$(echo "${{ gitea.actor }}" | tr '[:upper:]' '[:lower:]')
echo "name=${NAME}" >> $GITHUB_OUTPUT
echo "owner=${OWNER}" >> $GITHUB_OUTPUT
- name: Build and push image
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile
push: true
tags: |
${{ env.REGISTRY }}/${{ steps.meta.outputs.owner }}/${{ steps.meta.outputs.name }}:latest
${{ env.REGISTRY }}/${{ steps.meta.outputs.owner }}/${{ steps.meta.outputs.name }}:${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max