mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2026-07-12 15:53:12 +00:00
68 lines
1.6 KiB
YAML
68 lines
1.6 KiB
YAML
name: Deploy GitHub Pages
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- 'aggregator.html'
|
|
- '.github/workflows/deploy-pages.yml'
|
|
pull_request:
|
|
paths:
|
|
- 'aggregator.html'
|
|
- '.github/workflows/deploy-pages.yml'
|
|
|
|
permissions:
|
|
contents: read
|
|
pages: write
|
|
id-token: write
|
|
|
|
concurrency:
|
|
group: pages
|
|
cancel-in-progress: false
|
|
|
|
jobs:
|
|
build:
|
|
name: Validate and package Pages site
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Validate aggregator
|
|
run: |
|
|
test -s aggregator.html
|
|
grep -Fq '<!DOCTYPE html>' aggregator.html
|
|
grep -Fq 'obsidian://setuplivesync?settingsQR=' aggregator.html
|
|
sed -n '/<script>/,/<\/script>/p' aggregator.html | sed '1d;$d' > aggregator.js
|
|
node --check aggregator.js
|
|
rm aggregator.js
|
|
|
|
- name: Prepare Pages site
|
|
run: |
|
|
mkdir -p _site
|
|
cp aggregator.html _site/aggregator.html
|
|
touch _site/.nojekyll
|
|
|
|
- name: Configure GitHub Pages
|
|
uses: actions/configure-pages@v5
|
|
|
|
- name: Upload GitHub Pages artifact
|
|
uses: actions/upload-pages-artifact@v3
|
|
with:
|
|
path: _site
|
|
|
|
deploy:
|
|
name: Deploy GitHub Pages
|
|
if: github.event_name != 'pull_request'
|
|
needs: build
|
|
runs-on: ubuntu-latest
|
|
environment:
|
|
name: github-pages
|
|
url: ${{ steps.deployment.outputs.page_url }}
|
|
steps:
|
|
- name: Deploy GitHub Pages
|
|
id: deployment
|
|
uses: actions/deploy-pages@v4
|