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