-
Notifications
You must be signed in to change notification settings - Fork 0
56 lines (48 loc) · 1.7 KB
/
github-pages-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
name: Deploy in Github Pages
on:
push:
paths:
- 'slides/**'
permissions:
contents: write
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 2
- uses: actions/setup-node@v3
with:
node-version: '20'
- name: Install dependencies
run: npm install
- name: Install slidev
run: npm i -g @slidev/cli
- name: Get modified slide directories
id: get-dirs
run: |
# Get the list of modified slide markdown files
echo git show ${{ github.sha }} --name-only
modified_files=$(git show ${{ github.sha }} --name-only | grep "^slides/.*/.*.md$")
echo "Modified files: $modified_files"
# Initialize an empty string to store unique directories
modified_dirs=""
# Loop through modified files and extract their directories
for file in $modified_files; do
dir=$(dirname $file)
# Add directory to list, separated by space
modified_dirs="$modified_dirs $dir"
done
echo "Modified directories: $modified_dirs"
# Output the modified directories to be used as an environment variable
echo "modified_dirs=${modified_dirs}" >> $GITHUB_ENV
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages # The branch the action should deploy to.
folder: slides/${{env.talk_title}}/dist # The folder the action should deploy.
target-folder: ${{ env.talk_title }}
clean: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}