Skip to content

Commit

Permalink
ci: use corepack version of pnpm (#1052)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe authored Nov 4, 2024
1 parent b654743 commit de4d513
Showing 1 changed file with 11 additions and 24 deletions.
35 changes: 11 additions & 24 deletions .github/workflows/studio.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ on:
# Runs on pushes targeting the default branch
push:
branches: ["main"]
pull_request:
branches: ["main"]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
Expand Down Expand Up @@ -33,49 +35,34 @@ jobs:
node: [18]

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Identify package manager
id: pkgman
run: |
cache=`[ -f ".starters/default/pnpm-lock.yaml" ] && echo "pnpm" || ([ -f ".starters/default/package-lock.json" ] && echo "npm" || ([ -f ".starters/default/yarn.lock" ] && echo "yarn" || echo ""))`
package_manager=`[ ! -z "$cache" ] && echo "$cache" || echo "pnpm"`
echo "cache=$cache" >> $GITHUB_OUTPUT
echo "package_manager=$package_manager" >> $GITHUB_OUTPUT
- uses: pnpm/action-setup@v2.4.1
if: ${{ steps.pkgman.outputs.package_manager == 'pnpm' }}
name: Install pnpm
id: pnpm-install
with:
version: 8

- uses: actions/checkout@v4
- run: corepack enable
- uses: actions/setup-node@v4
with:
version: ${{ matrix.node }}
cache: ${{ steps.pkgman.outputs.cache }}
node-version: ${{ matrix.node }}
cache: "pnpm"

- name: Install dependencies
run: ${{ steps.pkgman.outputs.package_manager }} install
run: pnpm install

- name: Install @nuxthq/studio
run: ${{ steps.pkgman.outputs.package_manager }} add -D @nuxthq/studio
run: pnpm add -D @nuxthq/studio

- name: Create .nuxtrc
run: echo 'modules[]=@nuxthq/studio' > .nuxtrc

- name: Generate
run: ${{ steps.pkgman.outputs.package_manager }} nuxi generate
run: pnpm nuxi generate
env:
NUXT_PUBLIC_STUDIO_API_URL: https://api.nuxt.studio
NUXT_PUBLIC_STUDIO_TOKENS: e6364305a88b20d5fc79b360230231dd743831dff03b55edd6b4237b355bb7d9

- name: Add .nojekyll file
run: touch .output/public/.nojekyll

# Deployment job
# Deployment job
- name: Deploy 🚀
if: github.ref == 'refs/heads/main'
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: .starters/default/.output/public

0 comments on commit de4d513

Please sign in to comment.