mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2025-06-28 12:16:53 +00:00
Update nextjs.yml
This commit is contained in:
parent
84263159cd
commit
dce8062bb4
44
.github/workflows/nextjs.yml
vendored
44
.github/workflows/nextjs.yml
vendored
@ -1,31 +1,20 @@
|
|||||||
# Sample workflow for building and deploying a Next.js site to GitHub Pages
|
|
||||||
#
|
|
||||||
# To get started with Next.js see: https://nextjs.org/docs/getting-started
|
|
||||||
#
|
|
||||||
name: Deploy Next.js site to Pages
|
name: Deploy Next.js site to Pages
|
||||||
|
|
||||||
on:
|
on:
|
||||||
# Runs on pushes targeting the default branch
|
|
||||||
push:
|
push:
|
||||||
branches: ["main"]
|
branches: ["main"]
|
||||||
|
|
||||||
# Allows you to run this workflow manually from the Actions tab
|
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
pages: write
|
pages: write
|
||||||
id-token: write
|
id-token: write
|
||||||
|
|
||||||
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
|
|
||||||
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: "pages"
|
group: "pages"
|
||||||
cancel-in-progress: false
|
cancel-in-progress: false
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
# Build job
|
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
@ -34,12 +23,12 @@ jobs:
|
|||||||
- name: Detect package manager
|
- name: Detect package manager
|
||||||
id: detect-package-manager
|
id: detect-package-manager
|
||||||
run: |
|
run: |
|
||||||
if [ -f "${{ github.workspace }}/yarn.lock" ]; then
|
if [ -f "${{ github.workspace }}/web/yarn.lock" ]; then
|
||||||
echo "manager=yarn" >> $GITHUB_OUTPUT
|
echo "manager=yarn" >> $GITHUB_OUTPUT
|
||||||
echo "command=install" >> $GITHUB_OUTPUT
|
echo "command=install" >> $GITHUB_OUTPUT
|
||||||
echo "runner=yarn" >> $GITHUB_OUTPUT
|
echo "runner=yarn" >> $GITHUB_OUTPUT
|
||||||
exit 0
|
exit 0
|
||||||
elif [ -f "${{ github.workspace }}/package.json" ]; then
|
elif [ -f "${{ github.workspace }}/web/package.json" ]; then
|
||||||
echo "manager=npm" >> $GITHUB_OUTPUT
|
echo "manager=npm" >> $GITHUB_OUTPUT
|
||||||
echo "command=ci" >> $GITHUB_OUTPUT
|
echo "command=ci" >> $GITHUB_OUTPUT
|
||||||
echo "runner=npx --no-install" >> $GITHUB_OUTPUT
|
echo "runner=npx --no-install" >> $GITHUB_OUTPUT
|
||||||
@ -53,34 +42,41 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
node-version: "20"
|
node-version: "20"
|
||||||
cache: ${{ steps.detect-package-manager.outputs.manager }}
|
cache: ${{ steps.detect-package-manager.outputs.manager }}
|
||||||
|
cache-dependency-path: web/package-lock.json
|
||||||
- name: Setup Pages
|
- name: Setup Pages
|
||||||
uses: actions/configure-pages@v5
|
uses: actions/configure-pages@v5
|
||||||
with:
|
with:
|
||||||
# Automatically inject basePath in your Next.js configuration file and disable
|
|
||||||
# server side image optimization (https://nextjs.org/docs/api-reference/next/image#unoptimized).
|
|
||||||
#
|
|
||||||
# You may remove this line if you want to manage the configuration yourself.
|
|
||||||
static_site_generator: next
|
static_site_generator: next
|
||||||
- name: Restore cache
|
- name: Restore cache
|
||||||
uses: actions/cache@v4
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
.next/cache
|
web/.next/cache
|
||||||
# Generate a new cache whenever packages or source files change.
|
|
||||||
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
|
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
|
||||||
# If source files changed but packages didn't, rebuild from a prior cache.
|
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-
|
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }}
|
run: |
|
||||||
|
cd web
|
||||||
|
${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }}
|
||||||
- name: Build with Next.js
|
- name: Build with Next.js
|
||||||
run: ${{ steps.detect-package-manager.outputs.runner }} next build
|
run: |
|
||||||
|
cd web
|
||||||
|
${{ steps.detect-package-manager.outputs.runner }} next build
|
||||||
|
- name: Static HTML export with Next.js
|
||||||
|
run: |
|
||||||
|
cd web
|
||||||
|
${{ steps.detect-package-manager.outputs.runner }} next export
|
||||||
|
- name: Copy guides and changelog
|
||||||
|
run: |
|
||||||
|
mkdir -p web/out/guides
|
||||||
|
cp guides/*.md web/out/guides/
|
||||||
|
cp CHANGELOG.md web/out/
|
||||||
- name: Upload artifact
|
- name: Upload artifact
|
||||||
uses: actions/upload-pages-artifact@v3
|
uses: actions/upload-pages-artifact@v3
|
||||||
with:
|
with:
|
||||||
path: ./out
|
path: web/out
|
||||||
|
|
||||||
# Deployment job
|
|
||||||
deploy:
|
deploy:
|
||||||
environment:
|
environment:
|
||||||
name: github-pages
|
name: github-pages
|
||||||
|
Loading…
x
Reference in New Issue
Block a user