-
Notifications
You must be signed in to change notification settings - Fork 3
52 lines (50 loc) · 1.65 KB
/
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
name: Deploy
on:
push:
branches:
- main
permissions:
contents: write
jobs:
precheck:
runs-on: ubuntu-latest
outputs:
should_deploy: ${{ steps.check.outputs.should_deploy }}
steps:
- name: Check if this is the template
id: check
run: |
if [ "${{ github.repository }}" = "jazzsequence/profile.github.io" ]; then
echo "should_deploy=false" >> $GITHUB_OUTPUT
echo "Actions running on parent repository. Deploy to GitHub pages will be skipped."
else
echo "should_deploy=true" >> $GITHUB_OUTPUT
echo "Actions running on forked repository. Deploying to GitHub is enabled."
fi
env:
GITHUB_OUTPUT: $GITHUB_OUTPUT
deploy:
needs: precheck
runs-on: ubuntu-latest
if: needs.precheck.outputs.should_deploy == 'true'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '16'
- name: Install Dependencies
run: npm install
- name: Build
run: npm run build
- name: Configure Git
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
- name: Deploy to GitHub Pages
env:
CI: true
GIT_USER: github-actions[bot] # Add user for gh-pages package
GITHUB_TOKEN: ${{ github.token }} # Authenticate with the token
run: npx gh-pages -d build --repo https://x-access-token:${{ github.token }}@github.com/${{ github.repository }}.git