vault backup: 2024-12-18 19:42:09 #5510
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |