-
Notifications
You must be signed in to change notification settings - Fork 0
63 lines (52 loc) · 1.96 KB
/
deploy-gh-pages.yml
File metadata and controls
63 lines (52 loc) · 1.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
name: Deploy Angular to GitHub Pages
on:
push:
branches:
- master
paths:
- 'Clients/TalentManagement-Angular-Material'
- '.github/workflows/deploy-gh-pages.yml'
workflow_dispatch:
permissions:
contents: write
env:
ANGULAR_APP_DIR: 'Clients/TalentManagement-Angular-Material/talent-management'
BASE_HREF: '/AngularNetTutorial/'
jobs:
build-and-deploy:
name: Build and Deploy to GitHub Pages
runs-on: ubuntu-latest
steps:
- name: Checkout repository (with submodules)
uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '22.x'
cache: 'npm'
cache-dependency-path: '${{ env.ANGULAR_APP_DIR }}/package-lock.json'
- name: Install dependencies
working-directory: ${{ env.ANGULAR_APP_DIR }}
run: npm ci
- name: Inject production environment variables
working-directory: ${{ env.ANGULAR_APP_DIR }}
env:
API_URL: ${{ secrets.API_APP_URL }}
IDENTITY_SERVER_URL: ${{ secrets.IDENTITY_SERVER_URL }}
run: |
sed -i "s|https://your-production-api.com/api/v1|${API_URL}/api/v1|g" src/environments/environment.prod.ts
sed -i "s|https://localhost:44310|${IDENTITY_SERVER_URL}|g" src/environments/environment.prod.ts
- name: Build Angular for GitHub Pages
working-directory: ${{ env.ANGULAR_APP_DIR }}
run: npm run build -- --configuration production --base-href "${{ env.BASE_HREF }}"
- name: Add 404.html for SPA deep-link routing
working-directory: ${{ env.ANGULAR_APP_DIR }}/dist/talent-management/browser
run: cp index.html 404.html
- name: Deploy to GitHub Pages
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: ${{ env.ANGULAR_APP_DIR }}/dist/talent-management/browser
branch: gh-pages
clean: true