diff --git a/.github/deploy.yml b/.github/deploy.yml new file mode 100644 index 0000000..eca45da --- /dev/null +++ b/.github/deploy.yml @@ -0,0 +1,66 @@ +name: Deploy Page + +on: + # Workflow dispatch only works when version has not been published yet + workflow_dispatch: + push: + branches: ["main"] + tags: + # Publish npm package when a new tag is pushed + - "*.*.*" + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +# Allow one concurrent deployment +concurrency: + group: "pages" + cancel-in-progress: true + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: 🛎️ Checkout + uses: actions/checkout@v4 + - uses: pnpm/action-setup@v3 + with: + version: 10 + - name: 🦭 Setup Node + uses: actions/setup-node@v4 + with: + node-version: lts/* + cache: pnpm + - name: 🛬 Install dependencies + run: pnpm install + - name: 👷 Build + run: pnpm build + # No tests + #- name: Test + # run: pnpm test + # Copy index.html to 404.html to serve the same file when a file is not found. This fixes GitHub Pages routing issues + - name: 🚷 Show index instead of 404 + run: cp ./dist/index.html ./dist/404.html + - name: 🆙 Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: ./dist + + deploy: + # Only start after build + needs: build + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + steps: + - name: 🛎️ Checkout + uses: actions/checkout@v4 + - name: 🚨 Setup Pages + uses: actions/configure-pages@v5 + - name: 🚀 Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4