Files
rxminder/.github/workflows/build-deploy.yml
William Valentin 190cffb61b refactor: simplify Docker and CI/CD to use unified config
- Replace symlinked Dockerfile with simplified version in root
- Reduce Docker build args (unified config provides defaults)
- Update CI/CD workflows to use minimal build arguments
- Add nginx.conf to root directory (replace docker/nginx.conf)
- Remove docker-bake references from CI/CD workflows
- Focus on essential runtime overrides only
- Let unified config handle smart defaults
2025-09-08 21:24:20 -07:00

99 lines
2.4 KiB
YAML

name: Build and Deploy
on:
push:
branches: [main, develop]
pull_request:
branches: [main]
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=sha
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
NODE_ENV=production
VITE_COUCHDB_URL=${{ vars.VITE_COUCHDB_URL }}
VITE_COUCHDB_USER=${{ vars.VITE_COUCHDB_USER }}
VITE_COUCHDB_PASSWORD=${{ secrets.VITE_COUCHDB_PASSWORD }}
cache-from: type=gha
cache-to: type=gha,mode=max
test:
runs-on: ubuntu-latest
needs: build
if: github.event_name == 'pull_request'
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Run linting
run: bun run lint
- name: Run type checking
run: bun run type-check
- name: Run tests
run: bun run test
deploy:
runs-on: ubuntu-latest
needs: [build, test]
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
environment: production
steps:
- name: Deploy to production
run: |
echo "Deploy to production server"
# Add your deployment commands here
# Example: SSH to server and pull the new image