feat(site): prebuild trajectory share urls #101
This file contains hidden or 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 Next.js site to Pages | |
| on: | |
| push: | |
| branches: ["main"] | |
| pull_request: | |
| types: [opened, reopened, synchronize, closed] | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }} | |
| cancel-in-progress: true | |
| jobs: | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| - name: Setup Bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: latest | |
| - name: Install dependencies | |
| run: bun install --frozen-lockfile | |
| working-directory: site | |
| - name: Setup Pages | |
| id: setup_pages | |
| uses: actions/configure-pages@v5 | |
| - name: Set base uri | |
| run: | | |
| if [ "${{ github.event_name }}" = "pull_request" ]; then | |
| echo "NEXT_PUBLIC_BASE_PATH=${{ steps.setup_pages.outputs.base_path }}/pr-preview/pr-${{ github.event.pull_request.number }}" >> "$GITHUB_ENV" | |
| else | |
| echo "NEXT_PUBLIC_BASE_PATH=${{ steps.setup_pages.outputs.base_path }}" >> "$GITHUB_ENV" | |
| fi | |
| - name: Build with Next.js | |
| run: bun run build | |
| working-directory: site | |
| - name: Deploy preview | |
| if: github.event_name == 'pull_request' | |
| uses: rossjrw/pr-preview-action@v1 | |
| with: | |
| source-dir: site/out | |
| - name: Deploy production | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| uses: JamesIves/github-pages-deploy-action@v4 | |
| with: | |
| clean-exclude: pr-preview/ | |
| force: false | |
| folder: site/out |