-
Notifications
You must be signed in to change notification settings - Fork 0
64 lines (54 loc) · 1.79 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
53
54
55
56
57
58
59
60
61
62
63
64
name: Build and Deploy
on:
push:
branches:
- main
schedule:
- cron: '0 0 * * 1'
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: main
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 'latest'
- name: Install Dependencies
run: npm ci
- name: Get blog feed URL from 'src/customizations/siteproperties.json'
id: get-url
run: |
feedUrl=$(node -e "const fs = require('fs'); const sitedata = JSON.parse(fs.readFileSync('src/customizations/siteproperties.json', 'utf8')); const feedUrl = sitedata.substackUrl + '/feed'; console.log(feedUrl);")
echo "feedUrl=$feedUrl" >> $GITHUB_ENV
- name: Fetch RSS Feed
uses: Promptly-Technologies-LLC/rss-fetch-action@v1
with:
feed_url: ${{ env.feedUrl }}
file_path: 'src/components/ui/RssFeed.json'
remove_last_build_date: true
- name: Build
run: npm run build
- name: Commit and push changes to repository
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: 'Automated build/blog feed update'
- name: Set the domain
id: set-domain
run: |
echo "DOMAIN=$(node -e 'console.log(new URL(require(\"./src/customizations/siteproperties.json\").url).hostname)')" >> $GITHUB_ENV
- name: Add CNAME to dist
run: |
if [[ "${{ env.DOMAIN }}" != *.github.io ]]; then
echo ${{ env.DOMAIN }} > ./dist/CNAME
fi
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: dist
branch: gh-pages
single-commit: true