-
Notifications
You must be signed in to change notification settings - Fork 0
56 lines (47 loc) · 1.65 KB
/
Copy pathdeploy-gh-pages.yml
File metadata and controls
56 lines (47 loc) · 1.65 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
name: Deploy portfolio to GitHub Pages
on:
push:
branches:
- master
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
- name: Cache npm
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('portfolio/package-lock.json', 'portfolio/pnpm-lock.yaml', 'portfolio/package.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install dependencies (portfolio)
run: npm install --prefix portfolio
- name: Build (portfolio)
run: npm run build --prefix portfolio
- name: Configure Git identity for deploy
env:
DEPLOY_NAME: ${{ secrets.DEPLOY_NAME }}
DEPLOY_EMAIL: ${{ secrets.DEPLOY_EMAIL }}
run: |
# Use provided secrets if available (set DEPLOY_NAME and DEPLOY_EMAIL in repo secrets),
# otherwise fall back to the actor name and the actor noreply email
if [ -n "$DEPLOY_NAME" ]; then
git config --global user.name "$DEPLOY_NAME"
else
git config --global user.name "$GITHUB_ACTOR"
fi
if [ -n "$DEPLOY_EMAIL" ]; then
git config --global user.email "$DEPLOY_EMAIL"
else
git config --global user.email "$GITHUB_ACTOR@users.noreply.github.com"
fi
- name: Deploy to gh-pages
run: npm run gh-pages --prefix portfolio
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}