update file 1728477941042-Snipaste_2024-10-09_20-45-32.png #58
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: site | |
on: | |
push: | |
branches: ['main'] | |
workflow_dispatch: | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | |
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | |
concurrency: | |
group: "pages" | |
cancel-in-progress: false | |
jobs: | |
deploy: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Use Node.js 20.x | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20.x | |
- uses: pnpm/action-setup@v3 | |
with: | |
version: 8 | |
- name: fetch cache | |
uses: actions/cache@v3 | |
id: cache | |
with: | |
key: static-site | |
path: dist | |
- uses: actions/checkout@v4 | |
if: steps.cache.outputs.cache-hit != 'true' | |
with: | |
repository: qwertyyb/writing | |
ref: feature/prosemirror | |
path: site | |
- name: build site | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: | | |
cd site/packages/static-frontend | |
pnpm install | |
pnpm run build-only | |
- name: move static files | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: | | |
mv $GITHUB_WORKSPACE/site/packages/static-frontend/dist $GITHUB_WORKSPACE/dist | |
- uses: actions/checkout@v4 | |
with: | |
path: data | |
- name: build list | |
run: | | |
cd $GITHUB_WORKSPACE/data | |
pnpm install | |
pnpm run build | |
- name: update data | |
run: | | |
rm -rf $GITHUB_WORKSPACE/dist/data | |
cp -r $GITHUB_WORKSPACE/data/data $GITHUB_WORKSPACE/dist/data | |
ls $GITHUB_WORKSPACE/dist | |
- name: Setup Pages | |
uses: actions/configure-pages@v4 | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
# Upload entire repository | |
path: dist | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 | |