Skip to content

Commit

Permalink
chore(deployment): add workflow file
Browse files Browse the repository at this point in the history
  • Loading branch information
Marimax01 authored Oct 25, 2024
1 parent 3644fe7 commit b3e9a96
Showing 1 changed file with 77 additions and 0 deletions.
77 changes: 77 additions & 0 deletions .github/workflows/studio.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@

name: studio-nuxt-build
run-name: studio nuxt build

on:
# Runs on pushes targeting the default branch
push:
branches:
- 'develop'

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Add write workflow permissions
permissions:
contents: write

# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true

jobs:
# Build job
build-and-deploy:
runs-on: ${{ matrix.os }}
defaults:
run:
working-directory: .

strategy:
matrix:
os: [ubuntu-latest]
node: [20]

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

- name: Identify package manager
id: pkgman
run: |
cache=`[ -f "./pnpm-lock.yaml" ] && echo "pnpm" || ([ -f "./package-lock.json" ] && echo "npm" || ([ -f "./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@v4
if: ${{ steps.pkgman.outputs.package_manager == 'pnpm' }}
name: Install pnpm
id: pnpm-install

- uses: actions/setup-node@v4
with:
version: ${{ matrix.node }}
cache: ${{ steps.pkgman.outputs.cache }}

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

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

- name: Create .nuxtrc
run: echo $'\nautoImport=true\nmodules[]=@nuxthq/studio' >> .nuxtrc

- name: Generate
run: npx nuxi build --preset github_pages
env:
NUXT_PUBLIC_STUDIO_API_URL: https://api.nuxt.studio


# Deployment job
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: ./.output/public

0 comments on commit b3e9a96

Please sign in to comment.