name: Dev
on:
  push:
    branches-ignore:
      - 'develop'
      - 'feature/update**'

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

jobs:
  build_docker:
    name: Build Docker image
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Set up node & dependencies
        uses: actions/setup-node@v4
        with:
          node-version: 20
          cache: "npm"
      - run: npm ci    
      - name: Run the TypeScript build
        run: npx tsc
      - name: Create server-package.json
        run: cat package.json | grep -v electron > server-package.json
      - uses: docker/setup-buildx-action@v3
      - uses: docker/build-push-action@v6
        with:
          context: .
          cache-from: type=gha
          cache-to: type=gha,mode=max