Skip to content

Commit 4f800c1

Browse files
authored
chore(deployment): add github action
1 parent b90e8c8 commit 4f800c1

File tree

1 file changed

+80
-0
lines changed

1 file changed

+80
-0
lines changed

.github/workflows/studio.yml

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

0 commit comments

Comments
 (0)