Fix Gitea pipeline workspace handling
This commit is contained in:
+20
-17
@@ -53,23 +53,28 @@ jobs:
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Setup .NET SDK
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: '8.0.x'
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '24'
|
||||
|
||||
- name: Backend build
|
||||
run: |
|
||||
set -euo pipefail
|
||||
docker run --rm \
|
||||
-v "${{ gitea.workspace }}:/workspace" \
|
||||
-w /workspace \
|
||||
mcr.microsoft.com/dotnet/sdk:8.0-alpine \
|
||||
sh -lc 'dotnet restore Backend/Backend.csproj && dotnet build Backend/Backend.csproj --no-restore --configuration Release'
|
||||
dotnet restore Backend/Backend.csproj
|
||||
dotnet build Backend/Backend.csproj --no-restore --configuration Release
|
||||
|
||||
- name: Frontend build
|
||||
run: |
|
||||
set -euo pipefail
|
||||
docker run --rm \
|
||||
-v "${{ gitea.workspace }}:/workspace" \
|
||||
-w /workspace/frontend \
|
||||
node:24-alpine \
|
||||
sh -lc 'npm ci && npm run build'
|
||||
npm ci
|
||||
npm run build
|
||||
working-directory: frontend
|
||||
|
||||
deploy:
|
||||
name: Deploy to award.noveria.net
|
||||
@@ -77,8 +82,8 @@ jobs:
|
||||
needs: verify
|
||||
timeout-minutes: 30
|
||||
if: |
|
||||
github.event_name == 'workflow_dispatch' ||
|
||||
(github.event_name == 'push' && gitea.ref == 'refs/heads/main')
|
||||
gitea.event_name == 'workflow_dispatch' ||
|
||||
(gitea.event_name == 'push' && gitea.ref == 'refs/heads/main')
|
||||
env:
|
||||
DEPLOY_PATH: /home/projekte_bao/vtuber-awards
|
||||
DEPLOY_APP_PATH: /home/projekte_bao/vtuber-awards/app
|
||||
@@ -114,23 +119,21 @@ jobs:
|
||||
- name: Sync code to production app directory
|
||||
run: |
|
||||
set -euo pipefail
|
||||
docker run --rm \
|
||||
-v "${{ gitea.workspace }}:/src:ro" \
|
||||
tar --exclude=.git -cf - . | docker run --rm -i \
|
||||
-v "${DEPLOY_APP_PATH}:/dest" \
|
||||
alpine:latest \
|
||||
sh -lc '
|
||||
set -e
|
||||
dest_owner="$(stat -c "%u:%g" /dest)"
|
||||
find /dest -mindepth 1 -maxdepth 1 ! -name .git -exec rm -rf {} +
|
||||
cd /src
|
||||
find . -mindepth 1 -maxdepth 1 ! -name .git -exec cp -R {} /dest/ \;
|
||||
tar -xf - -C /dest
|
||||
chown -R "$dest_owner" /dest
|
||||
'
|
||||
|
||||
- name: Build Docker images
|
||||
run: |
|
||||
set -euo pipefail
|
||||
no_cache="${{ github.event_name == 'workflow_dispatch' && inputs.no_cache || false }}"
|
||||
no_cache="${{ gitea.event_name == 'workflow_dispatch' && inputs.no_cache || false }}"
|
||||
build_args=""
|
||||
if [ "$no_cache" = "true" ]; then
|
||||
build_args="--no-cache"
|
||||
|
||||
Reference in New Issue
Block a user