-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (57 loc) · 2.04 KB
/
build-and-deploy.yml
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
64
65
66
67
68
69
name: Build and Deploy
on:
# push:
# branches:
# - main
workflow_dispatch:
jobs:
build-and-deploy:
runs-on: ubuntu-latest
permissions: write-all
env:
VITE_AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
VITE_SECRET_INJECTION_TEST: ${{ secrets.SECRET_INJECTION_TEST }}
VITE_MY_MICROSOFT_EMAIL: ${{ secrets.MY_MICROSOFT_EMAIL }}
VITE_GITHUB_REPO: ${{ github.event.repository.name }}
VITE_GITHUB_OWNER: ${{ github.event.repository.owner.login }}
VITE_GITHUB_FILE_PATH: "public/me.jpeg"
VITE_GITHUB_PRESENCE_PATH: "public/me.json"
VITE_PUT_FILE_PAT: ${{ secrets.PUT_FILE_PAT }}
VITE_BASE_URL: 'https://cynicdog.github.io/azure-entra-in-spa'
steps:
- name: Checkout code
uses: actions/[email protected]
- name: Set up Node.js
uses: actions/[email protected]
with:
node-version: '16'
cache: 'npm'
- name: Cache NPM dependencies
id: cache-npm-deps
uses: actions/cache@v4
with:
path: |
~/.npm
node_modules
key: node-cache-${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
node-cache-${{ runner.os }}-npm-
- name: Install dependencies
if: steps.cache-npm-deps.outputs.cache-hit != 'true'
run: npm install
- name: Build the app
run: npm run build
- name: Pre-deploy to GitHub Pages
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npm run predeploy
- name: Configure git to use HTTPS and set credentials
run: |
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com"
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git
- name: Deploy to GitHub Pages
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
npm run deploy