Skip to content

Commit 0554e01

Browse files
committed
Merge branch 'main' of github.com:cxjohn/cxjohn.github.io into main
2 parents 89f0b1a + 6764d5b commit 0554e01

File tree

2 files changed

+95
-0
lines changed

2 files changed

+95
-0
lines changed

.github/workflows/nextjs.yml

+94
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
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: ["main"]
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 one concurrent deployment
22+
concurrency:
23+
group: "pages"
24+
cancel-in-progress: true
25+
26+
jobs:
27+
# Build job
28+
build:
29+
runs-on: ubuntu-latest
30+
steps:
31+
- name: Checkout
32+
uses: actions/checkout@v3
33+
- name: Detect package manager
34+
id: detect-package-manager
35+
run: |
36+
if [ -f "${{ github.workspace }}/yarn.lock" ]; then
37+
echo "::set-output name=manager::yarn"
38+
echo "::set-output name=command::install"
39+
echo "::set-output name=runner::yarn"
40+
exit 0
41+
elif [ -f "${{ github.workspace }}/package.json" ]; then
42+
echo "::set-output name=manager::npm"
43+
echo "::set-output name=command::ci"
44+
echo "::set-output name=runner::npx --no-install"
45+
exit 0
46+
else
47+
echo "Unable to determine packager manager"
48+
exit 1
49+
fi
50+
- name: Setup Node
51+
uses: actions/setup-node@v3
52+
with:
53+
node-version: "16"
54+
cache: ${{ steps.detect-package-manager.outputs.manager }}
55+
- name: Setup Pages
56+
uses: actions/configure-pages@v2
57+
with:
58+
# Automatically inject basePath in your Next.js configuration file and disable
59+
# server side image optimization (https://nextjs.org/docs/api-reference/next/image#unoptimized).
60+
#
61+
# You may remove this line if you want to manage the configuration yourself.
62+
static_site_generator: next
63+
- name: Restore cache
64+
uses: actions/cache@v3
65+
with:
66+
path: |
67+
.next/cache
68+
# Generate a new cache whenever packages or source files change.
69+
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
70+
# If source files changed but packages didn't, rebuild from a prior cache.
71+
restore-keys: |
72+
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-
73+
- name: Install dependencies
74+
run: ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }}
75+
- name: Build with Next.js
76+
run: ${{ steps.detect-package-manager.outputs.runner }} next build
77+
- name: Static HTML export with Next.js
78+
run: ${{ steps.detect-package-manager.outputs.runner }} next export
79+
- name: Upload artifact
80+
uses: actions/upload-pages-artifact@v1
81+
with:
82+
path: ./out
83+
84+
# Deployment job
85+
deploy:
86+
environment:
87+
name: github-pages
88+
url: ${{ steps.deployment.outputs.page_url }}
89+
runs-on: ubuntu-latest
90+
needs: build
91+
steps:
92+
- name: Deploy to GitHub Pages
93+
id: deployment
94+
uses: actions/deploy-pages@v1

CNAME

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
cxjohn.me

0 commit comments

Comments
 (0)