Update build and add deploy pipeline (#25)
Some checks failed
Game Ideas deploy / build-test-deploy (push) Failing after 1m25s
Some checks failed
Game Ideas deploy / build-test-deploy (push) Failing after 1m25s
Reviewed-on: #25
This commit was merged in pull request #25.
This commit is contained in:
@@ -1,25 +1,30 @@
|
|||||||
name: Game Ideas build for PR
|
name: Game Ideas build for PR
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
types: [ opened, edited, reopened, synchronize ]
|
types: [ opened, edited, reopened, synchronize ]
|
||||||
branches:
|
branches:
|
||||||
- 'feature/**'
|
- main
|
||||||
- main
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build_blazor_app:
|
build_blazor_app:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Check out repository
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Setup DotNet
|
- name: Setup .NET 9
|
||||||
uses: actions/setup-dotnet@v4
|
uses: actions/setup-dotnet@v4
|
||||||
with:
|
with:
|
||||||
dotnet-version: '9'
|
dotnet-version: '9.0.x'
|
||||||
|
|
||||||
- name: Build Blazor App
|
- name: Restore dependencies
|
||||||
run: dotnet build ./src/GameIdeas/Client/GameIdeas.BlazorApp/GameIdeas.BlazorApp.csproj
|
run: dotnet restore ./src/GameIdeas/GameIdeas.sln
|
||||||
|
|
||||||
- name: Build API App
|
- name: Build API
|
||||||
run: dotnet build ./src/GameIdeas/Server/GameIdeas.WebAPI/GameIdeas.WebAPI.csproj
|
run: dotnet build ./src/GameIdeas/Server/GameIdeas.WebAPI/GameIdeas.WebAPI.csproj --configuration Release
|
||||||
|
|
||||||
|
- name: Build Blazor App
|
||||||
|
run: dotnet build ./src/GameIdeas/Client/GameIdeas.BlazorApp/GameIdeas.BlazorApp.csproj --configuration Release
|
||||||
|
|
||||||
|
- name: Test API
|
||||||
|
run: dotnet test ./src/GameIdeas/Server/GameIdeas.WebAPI.Tests/GameIdeas.WebAPI.Tests.csproj --configuration Release
|
||||||
92
.gitea/workflows/deploy.yaml
Normal file
92
.gitea/workflows/deploy.yaml
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
name: Game Ideas deploy
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main] # Déclenchement sur push sur main
|
||||||
|
workflow_dispatch: # Lancer manuellement
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-test-deploy:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup .NET 9
|
||||||
|
uses: actions/setup-dotnet@v4
|
||||||
|
with:
|
||||||
|
dotnet-version: '9.0.x'
|
||||||
|
|
||||||
|
- name: Restore dependencies
|
||||||
|
run: dotnet restore ./src/GameIdeas/GameIdeas.sln
|
||||||
|
|
||||||
|
- name: Build API
|
||||||
|
run: dotnet build ./src/GameIdeas/Server/GameIdeas.WebAPI/GameIdeas.WebAPI.csproj --configuration Release
|
||||||
|
|
||||||
|
- name: Build Blazor App
|
||||||
|
run: dotnet build ./src/GameIdeas/Client/GameIdeas.BlazorApp/GameIdeas.BlazorApp.csproj --configuration Release
|
||||||
|
|
||||||
|
- name: Test API
|
||||||
|
run: dotnet test ./src/GameIdeas/Server/GameIdeas.WebAPI.Tests/GameIdeas.WebAPI.Tests.csproj --configuration Release
|
||||||
|
|
||||||
|
- name: Publish API
|
||||||
|
run: dotnet publish ./src/GameIdeas/Server/GameIdeas.WebAPI/GameIdeas.WebAPI.csproj --configuration Release --output ./publish/api
|
||||||
|
|
||||||
|
- name: Publish Blazor App
|
||||||
|
run: dotnet publish ./src/GameIdeas/Client/GameIdeas.BlazorApp/GameIdeas.BlazorApp.csproj --configuration Release --output ./publish/blazor
|
||||||
|
|
||||||
|
- name: Copy API to Server
|
||||||
|
uses: appleboy/scp-action@v1
|
||||||
|
with:
|
||||||
|
host: ${{ secrets.DEV_HOST }}
|
||||||
|
username: ${{ secrets.DEV_USERNAME }}
|
||||||
|
password: ${{ secrets.DEV_PASSWORD }}
|
||||||
|
port: ${{ secrets.DEV_PORT }}
|
||||||
|
source: "./publish/api/*"
|
||||||
|
target: "/home/gameideas/api"
|
||||||
|
|
||||||
|
- name: Copy Blazor App to Server
|
||||||
|
uses: appleboy/scp-action@v1
|
||||||
|
with:
|
||||||
|
host: ${{ secrets.DEV_HOST }}
|
||||||
|
username: ${{ secrets.DEV_USERNAME }}
|
||||||
|
password: ${{ secrets.DEV_PASSWORD }}
|
||||||
|
port: ${{ secrets.DEV_PORT }}
|
||||||
|
source: "./publish/blazor/*"
|
||||||
|
target: "/home/gameideas/blazor"
|
||||||
|
|
||||||
|
- name: Update Entity Framework API on server
|
||||||
|
uses: appleboy/ssh-action@v1
|
||||||
|
with:
|
||||||
|
host: ${{ secrets.DEV_HOST }}
|
||||||
|
username: ${{ secrets.DEV_USERNAME }}
|
||||||
|
password: ${{ secrets.DEV_PASSWORD }}
|
||||||
|
port: ${{ secrets.DEV_PORT }}
|
||||||
|
script: |
|
||||||
|
cd /home/gameideas/api
|
||||||
|
dotnet ef database update --no-build
|
||||||
|
|
||||||
|
- name: Start API on server
|
||||||
|
uses: appleboy/ssh-action@v1
|
||||||
|
with:
|
||||||
|
host: ${{ secrets.DEV_HOST }}
|
||||||
|
username: ${{ secrets.DEV_USERNAME }}
|
||||||
|
password: ${{ secrets.DEV_PASSWORD }}
|
||||||
|
port: ${{ secrets.DEV_PORT }}
|
||||||
|
script: |
|
||||||
|
pkill -f "GameIdeas.WebAPI" || true
|
||||||
|
cd /home/gameideas/api
|
||||||
|
nohup dotnet GameIdeas.WebAPI.dll > api.log 2>&1 &
|
||||||
|
|
||||||
|
- name: Start Blazor App on server
|
||||||
|
uses: appleboy/ssh-action@v1
|
||||||
|
with:
|
||||||
|
host: ${{ secrets.DEV_HOST }}
|
||||||
|
username: ${{ secrets.DEV_USERNAME }}
|
||||||
|
password: ${{ secrets.DEV_PASSWORD }}
|
||||||
|
port: ${{ secrets.DEV_PORT }}
|
||||||
|
script: |
|
||||||
|
pkill -f "GameIdeas.BlazorApp" || true
|
||||||
|
cd /home/gameideas/blazor
|
||||||
|
nohup dotnet GameIdeas.BlazorApp.dll > blazor.log 2>&1 &
|
||||||
Reference in New Issue
Block a user