This commit is contained in:
Michał Zieliński
2025-09-12 12:12:36 +02:00
parent ae6d2de4f6
commit 148bf73406
2 changed files with 55 additions and 89 deletions

View File

@@ -1,13 +1,9 @@
name: BuildApp
on:
# push:
# branches: [ main ]
# pull_request:
#branches: [ main ]
workflow_dispatch: {}
# (opcjonalnie) ogranicz równoległe runy
# (opcjonalnie; jeśli coś krzyczy w Twojej wersji Gitei, usuń całą sekcję concurrency)
concurrency:
group: build-${{ github.ref }}
cancel-in-progress: false
@@ -24,14 +20,11 @@ jobs:
with:
node-version: 20
# Zostawiamy jak u Ciebie, jeśli chcesz można też użyć corepack (pnpm) zamiast global install
- name: Install Angular CLI
run: npm install -g @angular/cli
- name: Install PNPM
run: npm install -g pnpm
# alternatywa:
# run: corepack enable && corepack prepare pnpm@latest --activate
- name: Install dependencies
working-directory: src/Frontend
@@ -45,8 +38,7 @@ jobs:
uses: https://github.com/actions/upload-artifact@v3
with:
name: frontend
path: |
src/Frontend/dist
path: src/Frontend/dist
if-no-files-found: error
retention-days: 7
@@ -124,28 +116,41 @@ jobs:
if-no-files-found: error
retention-days: 7
copy-artifacts:
store-artifacts:
runs-on: ubuntu-latest
- name: Upload artifact
uses: actions/upload-artifact@v3
needs: [build-frontend, build-backend]
if: ${{ success() }}
steps:
- name: Download frontend artifacts
uses: https://github.com/actions/download-artifact@v3
with:
name: frontend
path: frontend
- name: Download webapi artifacts
uses: https://github.com/actions/download-artifact@v3
with:
name: webapi
path: build/webapi
path: webapi
- name: Store artifacts locally on runner
if: success()
env:
BUILD_DIR: /runner-cache/builds/${{ github.run_id }}
run: |
BUILD_DIR="/runner-cache/builds/$GITHUB_RUN_ID"
set -euo pipefail
mkdir -p "$BUILD_DIR"
cp -r build/webapi/ "$BUILD_DIR/"
cp -r src/Frontend/dist/ "$BUILD_DIR/frontend/"
cp -r webapi "$BUILD_DIR/"
cp -r frontend "$BUILD_DIR/"
mkdir -p /runner-cache/builds
ln -sfn "$BUILD_DIR" /runner-cache/builds/latest
echo "BUILD_TIME=$(date -Iseconds)" > "$BUILD_DIR/build-info.txt"
echo "COMMIT_SHA=${GITHUB_SHA}" >> "$BUILD_DIR/build-info.txt"
echo "BRANCH=${GITHUB_REF_NAME}" >> "$BUILD_DIR/build-info.txt"
echo "BUILD_ID=${GITHUB_RUN_ID}" >> "$BUILD_DIR/build-info.txt"
ls -la "$BUILD_DIR/"
{
echo "BUILD_TIME=$(date -Iseconds)"
echo "COMMIT_SHA=${GITHUB_SHA}"
echo "BRANCH=${GITHUB_REF_NAME}"
echo "BUILD_ID=${GITHUB_RUN_ID}"
} > "$BUILD_DIR/build-info.txt"
echo "Build artifacts stored in: $BUILD_DIR"
ls -la "$BUILD_DIR/"
echo "Symlink 'latest' -> $(readlink -f /runner-cache/builds/latest)"