-
Notifications
You must be signed in to change notification settings - Fork 1
99 lines (85 loc) · 3.29 KB
/
generate.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
name: Publish to gh-pages branch
on:
push:
branches:
- main
concurrency:
group: environment-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
name: Build and Push
steps:
- name: Repository Dispatch
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.PAT }}
repository: blacklightpy/notes
event-type: notes-update
- name: Checkout main
uses: actions/checkout@v4
with:
ref: main
path: vaultofknowledge
- name: Install dependencies and run build
run: |
cd ${{ github.workspace }}
pip install --upgrade pip
pip install git+https://github.com/obsidian-html/obsidian-html
obsidianhtml convert -i vaultofknowledge/config.yaml -v
touch html/.nojekyll
- name: Publish to Github Pages
uses: s0/git-publish-subdir-action@develop
env:
REPO: self
BRANCH: gh-pages # The branch name where you want to push the assets
FOLDER: html # The directory where your assets are generated
SQUASH_HISTORY: true # Squashes branch history to avoid file buildup
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # GitHub will automatically add this - you don't need to bother getting a token
MESSAGE: "Build: ({sha}) {msg}" # The commit message
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
# 'pages' and 'contents' are set to read and write by default in settings
permissions:
pages: write
contents: write
id-token: write # to verify the deployment originates from an appropriate source
name: Generate Sitemap and Deploy to Github Pages
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: gh-pages
- name: Generate the sitemap
id: sitemap
uses: cicirello/generate-sitemap@v1
with:
base-url-path: https://blacklightpy.github.io/vaultofknowledge
additional-extensions: jpg jpeg png webp gif
exclude-paths: /not_created.html /index.html # excluded in config.yaml
- name: Output sitemap stats
run: |
echo "sitemap-path = ${{ steps.sitemap.outputs.sitemap-path }}"
echo "url-count = ${{ steps.sitemap.outputs.url-count }}"
echo "excluded-count = ${{ steps.sitemap.outputs.excluded-count }}"
- name: Commit & Push changes # used this because I'm too lazy to do manually
uses: devops-infra/action-commit-push@master
with:
github_token: "${{ secrets.GITHUB_TOKEN }}"
commit_message: "Added sitemap"
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
# Upload entire repository
path: '.'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4