Skip to content

3d engine

3d engine #84

Workflow file for this run

name: CI / Build Production Image
# Tests run automatically on push to main
# Docker build only runs when manually triggered
on:
push:
branches: [main]
workflow_dispatch:
env:
REGISTRY: ghcr.io
jobs:
test:
name: Run Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run tests
run: npm run test --if-present
build-and-push:
name: Build & Push Docker Image
runs-on: ubuntu-latest
needs: test
# Only run on manual trigger
if: github.event_name == 'workflow_dispatch'
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v6
- name: Repository name to lowercase
id: repo
run: echo "name=${GITHUB_REPOSITORY,,}" >> $GITHUB_OUTPUT
- name: Get version
id: version
run: echo "VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: |
${{ env.REGISTRY }}/${{ steps.repo.outputs.name }}:latest
${{ env.REGISTRY }}/${{ steps.repo.outputs.name }}:${{ steps.version.outputs.VERSION }}
${{ env.REGISTRY }}/${{ steps.repo.outputs.name }}:${{ github.sha }}
build-args: |
VITE_SUPABASE_URL=${{ secrets.VITE_SUPABASE_URL_PROD }}
VITE_SUPABASE_PUBLISHABLE_KEY=${{ secrets.VITE_SUPABASE_ANON_KEY_PROD }}
cache-from: type=gha
cache-to: type=gha,mode=max