Deploy Next.js site to Pages #11
Workflow file for this run
This file contains 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 | |
workflow_dispatch: | |
workflow_run: | |
workflows: | |
- Run dbt | |
types: | |
- completed | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
concurrency: | |
group: "pages" | |
cancel-in-progress: false | |
env: | |
WORKING_DIRECTORY: ./dashboard | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ${{ env.WORKING_DIRECTORY }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "lts/*" | |
cache: npm | |
cache-dependency-path: ${{ env.WORKING_DIRECTORY }} | |
- name: Setup Pages | |
uses: actions/configure-pages@v3 | |
- name: Install dependencies | |
run: npm ci | |
- name: Build with Next.js | |
run: npx --no-install next build | |
- name: Static HTML export with Next.js | |
run: npx --no-install next export | |
- name: Add .nojeckyll file to enforce styling | |
run: touch ${{ env.WORKING_DIRECTORY }}/out/.nojekyll | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v2 | |
with: | |
name: github-pages | |
path: ./${{ env.WORKING_DIRECTORY }}/out | |
deploy: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Deploy artifact to GitHub Pages | |
uses: actions/deploy-pages@v2 | |
id: deployment | |
with: | |
artifact_name: github-pages |