-
Notifications
You must be signed in to change notification settings - Fork 0
38 lines (34 loc) · 1.25 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
name: Build Deploy
on:
push:
branches:
- main
env:
TARGET_DIR: dist/signal-spreadsheet
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20.x'
- name: Set environment variable based on branch
run: |
if [[ $GITHUB_REF == refs/heads/main || $GITHUB_REF == refs/heads/master ]]; then
echo "Branch is main or master. Setting DRY_RUN_OPTION to empty."
echo "DRY_RUN_OPTION=" >> $GITHUB_ENV
else
echo "Branch is not main or master. Setting DRY_RUN_OPTION to '--dry-run'."
echo "DRY_RUN_OPTION=--dry-run" >> $GITHUB_ENV
fi
- name: Install
run: npm install
- name: Build
run: npm run build
- name: Deploy Website (gh-pages branch)
env:
GH_TOKEN: ${{ secrets.ACCESS_TOKEN }} # A token must be created to be able to deploy on the gh-pages branch
run: |
echo "DRY_RUN_OPTION=$DRY_RUN_OPTION"
npx angular-cli-ghpages --no-silent --name="Michał Nieruchalski" [email protected] --branch=gh-pages --dir="${{env.TARGET_DIR}}" $DRY_RUN_OPTION --cname=spreadsheet.nieruchalski.dev