diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 00000000..a33884cd --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,63 @@ +name: Angular + .NET CI + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + +# ================= ANGULAR ================= + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: 20.x + cache: 'npm' + cache-dependency-path: src/frontend/package-lock.json + + - name: Install Angular dependencies + working-directory: src/frontend + run: npm ci + + - name: Build Angular + working-directory: src/frontend + run: npm run build -- --configuration production + +# ================= .NET ================= + - name: Setup .NET 9 + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 9.0.x + + - name: Restore .NET + run: dotnet restore + + - name: Build .NET + run: dotnet build --configuration Release --no-restore + + - name: Run tests + run: dotnet test --no-build --verbosity normal + +# ========== Якщо Angular має бути в wwwroot ========== + - name: Copy Angular to wwwroot + run: | + rm -rf src/BackendApp/wwwroot/* + cp -r src/frontend/dist/* src/BackendApp/wwwroot/ + +# ================= Publish ================= + - name: Publish App + run: dotnet publish src/BackendApp/BackendApp.csproj -c Release -o out + + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: app-build + path: out