chore(env): add .env.example with GITHUB_TOKEN and site URL #14
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 to GitHub Pages | |
| on: | |
| push: | |
| branches: [ master ] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: pages | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: npm | |
| - name: Install dependencies | |
| run: npm ci | |
| # working-directory: ./web # Uncomment and set if your app is in a subfolder | |
| - name: Determine base path for GitHub Pages | |
| shell: bash | |
| run: | | |
| REPO_NAME='${{ github.event.repository.name }}' | |
| if [[ "$REPO_NAME" == *.github.io ]]; then | |
| echo "NEXT_BASE_PATH=" >> $GITHUB_ENV | |
| echo "NEXT_ASSET_PREFIX=/" >> $GITHUB_ENV | |
| echo "NEXT_PUBLIC_BASE_PATH=" >> $GITHUB_ENV | |
| else | |
| echo "NEXT_BASE_PATH=/$REPO_NAME" >> $GITHUB_ENV | |
| echo "NEXT_ASSET_PREFIX=/$REPO_NAME" >> $GITHUB_ENV | |
| echo "NEXT_PUBLIC_BASE_PATH=/$REPO_NAME" >> $GITHUB_ENV | |
| fi | |
| - name: Configure Pages | |
| uses: actions/configure-pages@v5 | |
| - name: Build static site | |
| run: npm run build | |
| env: | |
| NEXT_BASE_PATH: ${{ env.NEXT_BASE_PATH }} | |
| NEXT_ASSET_PREFIX: ${{ env.NEXT_ASSET_PREFIX }} | |
| NEXT_PUBLIC_BASE_PATH: ${{ env.NEXT_PUBLIC_BASE_PATH }} | |
| - name: Add .nojekyll | |
| run: echo > out/.nojekyll | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: out | |
| deploy: | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |