aduros / wasm4

Build retro games using WebAssembly for a fantasy console.
https://wasm4.org
ISC License
1.14k stars 167 forks source link

Switch website hosting to github pages #409

Open aduros opened 2 years ago

aduros commented 2 years ago

Netlify has some pretty low usage limits, let's look at switching to github pages and probably simplify CI a bit in the process.

lukki15 commented 4 months ago

I wrote a small GitHub workflow that would allow to publish the site with every push to main automatically To use it switch Build and deployment sources to GitHub actions in the GitHub Pages settings.

This script installs all dependencies, builds the site and publishes the result as deployment. Unfortunately is the current docusaurus.config.js url and baseUrl not compatible. (see link)

name: Deploy WASM-4 Site To Pages

on:
  # Runs on pushes targeting the default branch
  push:
    branches: ["main"]

# 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

env:
  NODE_OPTIONS: "--openssl-legacy-provider" # fixes Error: error:0308010C:digital envelope routines::unsupported

jobs:
  build:
    name: Build
    runs-on: ubuntu-latest
    defaults:
      run:
        working-directory: site
    steps:
      - uses: actions/checkout@v4

      - run: npm install
      - run: npm audit fix
        continue-on-error: true # many packages are outdated
      - run: npm run build

      - name: Upload artifact
        uses: actions/upload-pages-artifact@v3
        with:
          path: ./site/build

  deploy:
    environment:
      name: github-pages
      url: ${{ steps.deployment.outputs.page_url }}
    needs: build
    runs-on: ubuntu-latest
    name: Deploy
    steps:
      - name: Deploy to GitHub Pages
        id: deployment
        uses: actions/deploy-pages@v4