Skip to content

Commit

Permalink
Update nuxtjs.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
LeonKohli committed Nov 20, 2023
1 parent b61efb3 commit fa4cb43
Showing 1 changed file with 16 additions and 35 deletions.
51 changes: 16 additions & 35 deletions .github/workflows/nuxtjs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,53 +25,34 @@ concurrency:
cancel-in-progress: false

jobs:
# Build job
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Detect package manager
id: detect-package-manager
run: |
if [ -f "${{ github.workspace }}/yarn.lock" ]; then
echo "manager=yarn" >> $GITHUB_OUTPUT
echo "command=install" >> $GITHUB_OUTPUT
exit 0
elif [ -f "${{ github.workspace }}/package.json" ]; then
echo "manager=npm" >> $GITHUB_OUTPUT
echo "command=ci" >> $GITHUB_OUTPUT
exit 0
else
echo "Unable to determine package manager"
exit 1
fi
- name: Setup Node

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "16"
cache: ${{ steps.detect-package-manager.outputs.manager }}
- name: Setup Pages
uses: actions/configure-pages@v3
with:
# Automatically inject router.base in your Nuxt configuration file and set
# target to static (https://nuxtjs.org/docs/configuration-glossary/configuration-target/).
#
# You may remove this line if you want to manage the configuration yourself.
static_site_generator: nuxt
- name: Restore cache
node-version: '16'

- name: Install PNPM
run: npm install -g pnpm

- name: Cache node_modules
uses: actions/cache@v3
with:
path: |
dist
.nuxt
key: ${{ runner.os }}-nuxt-build-${{ hashFiles('dist') }}
path: ~/.pnpm-store
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-nuxt-build-
${{ runner.os }}-pnpm-
- name: Install dependencies
run: ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }}
run: pnpm install

- name: Static HTML export with Nuxt
run: ${{ steps.detect-package-manager.outputs.manager }} run generate
run: pnpm run generate

- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
Expand Down

0 comments on commit fa4cb43

Please sign in to comment.