Skip to content

chore: update .gitignore and remove trendweight-classic subproject #61

chore: update .gitignore and remove trendweight-classic subproject

chore: update .gitignore and remove trendweight-classic subproject #61

Workflow file for this run

name: CI/CD
on:
push:
branches: [ "*" ]
pull_request:
branches: [ main ]
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
DO_REGISTRY: registry.digitalocean.com
DO_IMAGE_NAME: ${{ secrets.DIGITALOCEAN_REGISTRY_NAME }}/trendweight
jobs:
frontend-checks:
name: Frontend Checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'
cache-dependency-path: apps/web/package-lock.json
- name: Install dependencies
working-directory: apps/web
run: npm ci
- name: TypeScript check
working-directory: apps/web
run: npm run typecheck
- name: Lint
working-directory: apps/web
run: npm run lint
backend-checks:
name: Backend Checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.0.x'
- name: Restore dependencies
working-directory: apps/api
run: dotnet restore
- name: Build
working-directory: apps/api
run: dotnet build --no-restore -c Release
- name: Test
working-directory: apps/api
run: dotnet test --no-build -c Release --verbosity normal
docker-build:
name: Docker Build
runs-on: ubuntu-latest
needs: [frontend-checks, backend-checks]
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GitHub Container Registry
if: github.ref == 'refs/heads/main'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Log in to DigitalOcean Container Registry
if: github.ref == 'refs/heads/main'
uses: docker/login-action@v3
with:
registry: ${{ env.DO_REGISTRY }}
username: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
password: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
- name: Extract metadata for GitHub Registry
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
type=raw,value=latest,enable={{is_default_branch}}
- name: Extract metadata for DigitalOcean Registry
id: meta-do
uses: docker/metadata-action@v5
with:
images: ${{ env.DO_REGISTRY }}/${{ env.DO_IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=sha
type=raw,value=latest,enable={{is_default_branch}}
- name: Get version
id: version
run: |
if [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/}
else
VERSION="build-${{ github.run_number }}"
fi
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
push: ${{ github.ref == 'refs/heads/main' }}
tags: |
${{ steps.meta.outputs.tags }}
${{ steps.meta-do.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
VITE_SUPABASE_URL=${{ secrets.VITE_SUPABASE_URL }}
VITE_SUPABASE_ANON_KEY=${{ secrets.VITE_SUPABASE_ANON_KEY }}
VITE_APPLE_SERVICES_ID=${{ secrets.VITE_APPLE_SERVICES_ID }}
BUILD_TIME=${{ github.event.head_commit.timestamp }}
BUILD_COMMIT=${{ github.sha }}
BUILD_BRANCH=${{ github.ref_name }}
BUILD_VERSION=${{ steps.version.outputs.version }}
BUILD_REPO=${{ github.repository }}