Skip to content

Commit 6b3430b

Browse files
committed
Create nextjs.yml
1 parent d3b9e4c commit 6b3430b

File tree

1 file changed

+93
-0
lines changed

1 file changed

+93
-0
lines changed

.github/workflows/nextjs.yml

+93
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# Sample workflow for building and deploying a Next.js site to GitHub Pages
2+
#
3+
# To get started with Next.js see: https://nextjs.org/docs/getting-started
4+
#
5+
name: Deploy Next.js site to Pages
6+
7+
on:
8+
# Runs on pushes targeting the default branch
9+
push:
10+
branches: ["github-pages"]
11+
12+
# Allows you to run this workflow manually from the Actions tab
13+
workflow_dispatch:
14+
15+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
16+
permissions:
17+
contents: read
18+
pages: write
19+
id-token: write
20+
21+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
22+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
23+
concurrency:
24+
group: "pages"
25+
cancel-in-progress: false
26+
27+
defaults:
28+
run:
29+
working-directory: ./airstrip-fe
30+
31+
jobs:
32+
# Build job
33+
build:
34+
runs-on: ubuntu-latest
35+
steps:
36+
- name: Checkout
37+
uses: actions/checkout@v4
38+
- name: Detect package manager
39+
id: detect-package-manager
40+
run: |
41+
echo "manager=yarn" >> $GITHUB_OUTPUT
42+
echo "command=install" >> $GITHUB_OUTPUT
43+
echo "runner=yarn" >> $GITHUB_OUTPUT
44+
- name: Check working directory
45+
run: |
46+
pwd
47+
ls -la
48+
- name: Setup Node
49+
uses: actions/setup-node@v4
50+
with:
51+
node-version: "20"
52+
cache: ${{ steps.detect-package-manager.outputs.manager }}
53+
- name: Setup Pages
54+
uses: actions/configure-pages@v5
55+
with:
56+
# Automatically inject basePath in your Next.js configuration file and disable
57+
# server side image optimization (https://nextjs.org/docs/api-reference/next/image#unoptimized).
58+
#
59+
# You may remove this line if you want to manage the configuration yourself.
60+
static_site_generator: next
61+
- name: Restore cache
62+
uses: actions/cache@v4
63+
with:
64+
path: |
65+
.next/cache
66+
# Generate a new cache whenever packages or source files change.
67+
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
68+
# If source files changed but packages didn't, rebuild from a prior cache.
69+
restore-keys: |
70+
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-
71+
- name: Install dependencies
72+
run: |
73+
pwd
74+
ls -la
75+
${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }}
76+
- name: Build with Next.js
77+
run: ${{ steps.detect-package-manager.outputs.runner }} next build
78+
- name: Upload artifact
79+
uses: actions/upload-pages-artifact@v3
80+
with:
81+
path: ./out
82+
83+
# Deployment job
84+
deploy:
85+
environment:
86+
name: github-pages
87+
url: ${{ steps.deployment.outputs.page_url }}
88+
runs-on: ubuntu-latest
89+
needs: build
90+
steps:
91+
- name: Deploy to GitHub Pages
92+
id: deployment
93+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)