Skip to content

Commit e340768

Browse files
authored
chore(deployment): add workflow file
1 parent 9dc5b37 commit e340768

File tree

1 file changed

+77
-0
lines changed

1 file changed

+77
-0
lines changed

.github/workflows/studio.yml

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
2+
name: studio-nuxt-build
3+
run-name: studio nuxt build
4+
5+
on:
6+
# Runs on pushes targeting the default branch
7+
push:
8+
branches:
9+
- 'master'
10+
11+
# Allows you to run this workflow manually from the Actions tab
12+
workflow_dispatch:
13+
14+
# Add write workflow permissions
15+
permissions:
16+
contents: write
17+
18+
# Allow one concurrent deployment
19+
concurrency:
20+
group: "pages"
21+
cancel-in-progress: true
22+
23+
jobs:
24+
# Build job
25+
build-and-deploy:
26+
runs-on: ${{ matrix.os }}
27+
defaults:
28+
run:
29+
working-directory: .
30+
31+
strategy:
32+
matrix:
33+
os: [ubuntu-latest]
34+
node: [20]
35+
36+
steps:
37+
- name: Checkout
38+
uses: actions/checkout@v4
39+
40+
- name: Identify package manager
41+
id: pkgman
42+
run: |
43+
cache=`[ -f "./pnpm-lock.yaml" ] && echo "pnpm" || ([ -f "./package-lock.json" ] && echo "npm" || ([ -f "./yarn.lock" ] && echo "yarn" || echo ""))`
44+
package_manager=`[ ! -z "$cache" ] && echo "$cache" || echo "pnpm"`
45+
echo "cache=$cache" >> $GITHUB_OUTPUT
46+
echo "package_manager=$package_manager" >> $GITHUB_OUTPUT
47+
48+
- uses: pnpm/action-setup@v4
49+
if: ${{ steps.pkgman.outputs.package_manager == 'pnpm' }}
50+
name: Install pnpm
51+
id: pnpm-install
52+
53+
- uses: actions/setup-node@v4
54+
with:
55+
version: ${{ matrix.node }}
56+
cache: ${{ steps.pkgman.outputs.cache }}
57+
58+
- name: Install dependencies
59+
run: ${{ steps.pkgman.outputs.package_manager }} install
60+
61+
- name: Install @nuxthq/studio
62+
run: ${{ steps.pkgman.outputs.package_manager }} add -D @nuxthq/studio
63+
64+
- name: Create .nuxtrc
65+
run: echo $'\nautoImport=true\nmodules[]=@nuxthq/studio' >> .nuxtrc
66+
67+
- name: Generate
68+
run: npx nuxi build --preset github_pages
69+
env:
70+
NUXT_PUBLIC_STUDIO_API_URL: https://api.nuxt.studio
71+
72+
73+
# Deployment job
74+
- name: Deploy 🚀
75+
uses: JamesIves/github-pages-deploy-action@v4
76+
with:
77+
folder: ./.output/public

0 commit comments

Comments
 (0)