Deploy Plugin Library Wiki To Github Pages + Netlify #25549
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: Deploy Plugin Library Wiki To Github Pages + Netlify | |
on: | |
push: | |
branches: | |
- master | |
paths-ignore: | |
- '.github/workflows/update-library.yml' | |
- libraries.json | |
schedule: | |
- cron: '0 * * * *' | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: write | |
pages: write | |
id-token: write | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Setup pnpm | |
uses: pnpm/action-setup@v4 | |
with: | |
version: 'latest' | |
run_install: false | |
- name: Get pnpm store directory | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | |
- uses: actions/cache@v4 | |
name: Setup pnpm cache | |
with: | |
path: ${{ env.STORE_PATH }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: Install pnpm dependencies | |
run: pnpm install | |
- name: Restore Plugin Cache | |
uses: actions/checkout@v4 | |
with: | |
ref: cache | |
path: cache | |
fetch-depth: 1 | |
- name: Build Library | |
run: pnpm run build | |
# - name: Minify Front Page HTML (also check if it exists) | |
# run: pnpm exec html-minifier-terser -c ./html-minifier-terser.config.json -o dist/index.html dist/index.html | |
# - name: Minify Library HTML (also check if it exists) | |
# run: pnpm exec html-minifier-terser -c ./html-minifier-terser.config.json -o dist/library/index.html dist/library/index.html | |
- name: Add history version from cache to library | |
run: | | |
rm -rf cache/.git | |
cp -r cache/plugins dist/repo | |
- name: Save Plugin Cache | |
uses: s0/git-publish-subdir-action@develop | |
env: | |
REPO: self | |
BRANCH: cache | |
FOLDER: cache | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Make offline cache | |
run: pnpm exec workbox injectManifest workbox-config.js | |
- 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 | |
- uses: jsmrcaga/[email protected] | |
with: | |
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_PERSONAL_ACCESS_TOKEN }} | |
NETLIFY_DEPLOY_TO_PROD: true | |
NETLIFY_SITE_ID: 97bd95f9-9e7e-4259-a883-c19fa3df2d20 | |
build_directory: ./dist | |
NETLIFY_DEPLOY_MESSAGE: "Deployed from GitHub action" | |
install_command: "echo Skipping installing the dependencies" | |
build_command: "echo Skipping building the web files" |