Skip to content

feat: add skeleton to mathjax loading #21

feat: add skeleton to mathjax loading

feat: add skeleton to mathjax loading #21

name: Deploy to Cloudflare Pages
on:
# Runs on pushes targeting all branches
# The main branch is for production, others for preview
# Comment out when using Cloudflare's own automatic deployments
push:
# Allows running this workflow manually from the Actions tab
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow the Cloudflare Pages action to create a Deployment
permissions:
contents: read
deployments: write
# Allow one concurrent deployment
# Ref is included in the group because Cloudflare can host multiple branches
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
# Build and deploy job
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set environment variables
run: |
echo "ENABLE_SSR=true" >> $GITHUB_ENV
echo "NUXT_PUBLIC_FULL_BASE_URL=https://limbuscompute.pages.dev" >> $GITHUB_ENV
echo "NUXT_PUBLIC_COMMIT_BASE_URL=https://github.com/MusicOnline/LimbusCompute/commit" >> $GITHUB_ENV
- name: Detect package manager
id: detect-package-manager
run: |
if [ -f "${{ github.workspace }}/yarn.lock" ]; then
echo "manager=yarn" >> $GITHUB_OUTPUT
echo "command=install" >> $GITHUB_OUTPUT
exit 0
elif [ -f "${{ github.workspace }}/pnpm-lock.yaml" ]; then
echo "manager=pnpm" >> $GITHUB_OUTPUT
echo "command=install" >> $GITHUB_OUTPUT
exit 0
elif [ -f "${{ github.workspace }}/package.json" ]; then
echo "manager=npm" >> $GITHUB_OUTPUT
echo "command=ci" >> $GITHUB_OUTPUT
exit 0
else
echo "Unable to determine packager manager"
exit 1
fi
# Must be done before Setup Node
- uses: pnpm/action-setup@v2
name: Install pnpm
if: ${{ steps.detect-package-manager.outputs.manager == 'pnpm' }}
with:
version: latest
run_install: false
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 20
cache: ${{ steps.detect-package-manager.outputs.manager }}
- name: Restore cache
uses: actions/cache@v3
with:
path: |
dist
.nuxt
key: ${{ runner.os }}-nuxt-build-${{ hashFiles('dist') }}
restore-keys: |
${{ runner.os }}-nuxt-build-
- name: Install dependencies
run: ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }}
- name: Prepare nuxt (postinstall)
run: ${{ steps.detect-package-manager.outputs.manager }} run postinstall
- name: Generate static site
run: ${{ steps.detect-package-manager.outputs.manager }} run generate
env:
NODE_OPTIONS: --max_old_space_size=8192
NITRO_PRESET: static
- name: Deploy to Cloudflare Pages
uses: cloudflare/pages-action@v1
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
projectName: limbuscompute
directory: .output/public
# Optional: Enable this to have GitHub Deployments triggered
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
- name: Zip artifact for upload
run: zip output.zip .output/public/* -r
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: cloudflare-pages
path: output.zip