Skip to content

Commit a582638

Browse files
authored
Update nuxtjs.yml
Signed-off-by: Florian <93609174+Xeferis@users.noreply.github.com>
1 parent 554d1eb commit a582638

File tree

1 file changed

+23
-70
lines changed

1 file changed

+23
-70
lines changed

.github/workflows/nuxtjs.yml

Lines changed: 23 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,89 +1,42 @@
1-
# Sample workflow for building and deploying a Nuxt site to GitHub Pages
2-
#
3-
# To get started with Nuxt see: https://nuxtjs.org/docs/get-started/installation
4-
#
5-
name: Deploy Nuxt site to Pages
6-
1+
# https://github.com/actions/deploy-pages#usage
2+
name: Deploy to GitHub Pages
73
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
134
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-
5+
push:
6+
branches:
7+
- prod
278
jobs:
28-
# Build job
299
build:
3010
runs-on: ubuntu-latest
3111
steps:
32-
- name: Checkout
33-
uses: actions/checkout@v4
34-
- name: Detect package manager
35-
id: detect-package-manager
36-
run: |
37-
if [ -f "${{ github.workspace }}/yarn.lock" ]; then
38-
echo "manager=yarn" >> $GITHUB_OUTPUT
39-
echo "command=install" >> $GITHUB_OUTPUT
40-
exit 0
41-
elif [ -f "${{ github.workspace }}/package.json" ]; then
42-
echo "manager=npm" >> $GITHUB_OUTPUT
43-
echo "command=ci" >> $GITHUB_OUTPUT
44-
exit 0
45-
else
46-
echo "Unable to determine package manager"
47-
exit 1
48-
fi
49-
- name: Setup Node
50-
uses: actions/setup-node@v4
12+
- uses: actions/checkout@v3
13+
- run: corepack enable
14+
- uses: actions/setup-node@v3
5115
with:
5216
node-version: "20"
53-
cache: ${{ steps.detect-package-manager.outputs.manager }}
54-
- name: Setup Pages
55-
uses: actions/configure-pages@v5
56-
with:
57-
# Automatically inject router.base in your Nuxt configuration file and set
58-
# target to static (https://nuxtjs.org/docs/configuration-glossary/configuration-target/).
59-
#
60-
# You may remove this line if you want to manage the configuration yourself.
61-
static_site_generator: nuxt
62-
- name: Restore cache
63-
uses: actions/cache@v4
64-
with:
65-
path: |
66-
dist
67-
.nuxt
68-
key: ${{ runner.os }}-nuxt-build-${{ hashFiles('dist') }}
69-
restore-keys: |
70-
${{ runner.os }}-nuxt-build-
71-
- name: Install dependencies
72-
run: ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }}
73-
- name: Static HTML export with Nuxt
74-
run: ${{ steps.detect-package-manager.outputs.manager }} run generate
17+
# Pick your own package manager and build script
18+
- run: npm install
19+
- run: npx nuxt build --preset github_pages
20+
env:
21+
NUXT_APP_BASE_URL: ${{ vars.NUXT_APP_BASE_URL }}
7522
- name: Upload artifact
7623
uses: actions/upload-pages-artifact@v3
7724
with:
78-
path: ./dist
79-
25+
path: ./.output/public
8026
# Deployment job
8127
deploy:
28+
# Add a dependency to the build job
29+
needs: build
30+
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
31+
permissions:
32+
pages: write # to deploy to Pages
33+
id-token: write # to verify the deployment originates from an appropriate source
34+
# Deploy to the github_pages environment
8235
environment:
83-
name: github-pages
36+
name: github_pages
8437
url: ${{ steps.deployment.outputs.page_url }}
38+
# Specify runner + deployment step
8539
runs-on: ubuntu-latest
86-
needs: build
8740
steps:
8841
- name: Deploy to GitHub Pages
8942
id: deployment

0 commit comments

Comments
 (0)