Add CI/CD pipeline for Blazor WASM build & deploy
This commit is contained in:
parent
0048fa93df
commit
1f006b9d72
1 changed files with 44 additions and 0 deletions
44
.forgejo/workflows/build.yml
Normal file
44
.forgejo/workflows/build.yml
Normal file
|
|
@ -0,0 +1,44 @@
|
||||||
|
name: Build & Test
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main, develop]
|
||||||
|
pull_request:
|
||||||
|
branches: [main]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container: mcr.microsoft.com/dotnet/sdk:10.0
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Restore dependencies
|
||||||
|
run: dotnet restore
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: dotnet build --no-restore --configuration Release
|
||||||
|
|
||||||
|
- name: Test
|
||||||
|
run: dotnet test --no-build --configuration Release --verbosity normal
|
||||||
|
|
||||||
|
publish:
|
||||||
|
needs: build
|
||||||
|
if: github.ref == 'refs/heads/main'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container: mcr.microsoft.com/dotnet/sdk:10.0
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Publish Blazor WASM
|
||||||
|
run: dotnet publish -c Release -o /tmp/publish
|
||||||
|
|
||||||
|
- name: Deploy to hosting
|
||||||
|
run: |
|
||||||
|
echo "Deploying StellarisIdle Blazor WASM to /srv/web/stellaris.holoshaii.dev/"
|
||||||
|
mkdir -p /srv/web/stellaris.holoshaii.dev
|
||||||
|
cp -r /tmp/publish/wwwroot/* /srv/web/stellaris.holoshaii.dev/
|
||||||
|
# Only works if runner runs on same host as web server
|
||||||
|
# For remote deploy, use rsync/scp instead
|
||||||
Loading…
Add table
Reference in a new issue