Skip to content

Commit 863e34f

Browse files
authored
chore(deployment): add workflow file
1 parent 1936c83 commit 863e34f

File tree

1 file changed

+82
-0
lines changed

1 file changed

+82
-0
lines changed

.github/workflows/studio.yml

+82
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
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+
- 'main'
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: [18]
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/[email protected]
49+
if: ${{ steps.pkgman.outputs.package_manager == 'pnpm' }}
50+
name: Install pnpm
51+
id: pnpm-install
52+
with:
53+
version: 8
54+
55+
- uses: actions/setup-node@v3
56+
with:
57+
version: ${{ matrix.node }}
58+
cache: ${{ steps.pkgman.outputs.cache }}
59+
60+
- name: Install dependencies
61+
run: ${{ steps.pkgman.outputs.package_manager }} install
62+
63+
- name: Install @nuxthq/studio
64+
run: ${{ steps.pkgman.outputs.package_manager }} add -D @nuxthq/studio
65+
66+
- name: Create .nuxtrc
67+
run: echo $'\nautoImport=true\nmodules[]=@nuxthq/studio' >> .nuxtrc
68+
69+
- name: Generate
70+
run: npx nuxi generate
71+
env:
72+
NUXT_PUBLIC_STUDIO_API_URL: https://api.nuxt.studio
73+
NUXT_PUBLIC_STUDIO_TOKENS: 941a11660f3736aed07c48f6d809a8ccf1b150df7626d5ad24bc6464b66022ad
74+
75+
- name: Add .nojekyll file
76+
run: touch .output/public/.nojekyll
77+
78+
# Deployment job
79+
- name: Deploy 🚀
80+
uses: JamesIves/github-pages-deploy-action@v4
81+
with:
82+
folder: ./.output/public

0 commit comments

Comments
 (0)