Skip to content

Commit

Permalink
chore: Update node versions and add pull request trigger in deploy.ym…
Browse files Browse the repository at this point in the history
…l workflow
  • Loading branch information
Reza Jafar committed May 23, 2024
1 parent da17a19 commit e666563
Show file tree
Hide file tree
Showing 3 changed files with 103 additions and 4 deletions.
14 changes: 10 additions & 4 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
name: Deploy to Netlify
name: Build and Deploy to Netlify

on:
push:
branches:
- 'main'
pull_request:
branches:
- 'main'
workflow_dispatch:

permissions:
Expand All @@ -19,21 +22,24 @@ jobs:

strategy:
matrix:
node: [20.x]
node-version: [14.x, 16.x, 18.x, 20.x]

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

- name: Set up Node.js ${{ matrix.node }}
- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
node-version: ${{ matrix.node-version }}
cache: 'yarn'

- name: Install dependencies
run: yarn install

- name: Run tests
run: yarn test

- name: Install @nuxthq/studio
run: yarn add -D @nuxthq/studio

Expand Down
36 changes: 36 additions & 0 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Node.js CI

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [14.x, 16.x, 18.x, 20.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

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

- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'

- name: Install dependencies
run: yarn install

- name: Run tests
run: yarn test

- name: Build project
run: yarn build
57 changes: 57 additions & 0 deletions .github/workflows/studio.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Studio Nuxt Build

on:
push:
branches:
- 'main'
workflow_dispatch:

permissions:
contents: write

concurrency:
group: "pages"
cancel-in-progress: true

jobs:
build-and-deploy:
runs-on: ubuntu-latest

strategy:
matrix:
node: [20.x]

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

- name: Set up Node.js ${{ matrix.node }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
cache: 'yarn'

- name: Install dependencies
run: yarn install

- name: Install @nuxthq/studio
run: yarn add -D @nuxthq/studio

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

- name: Build project
run: npx nuxi build
env:
NUXT_UI_PRO_LICENSE: ${{ secrets.NUXT_UI_PRO_LICENSE }}
NUXT_PUBLIC_STUDIO_API_URL: https://api.nuxt.studio
NUXT_PUBLIC_STUDIO_TOKENS: ${{ secrets.NUXT_PUBLIC_STUDIO_TOKENS }}
NUXT_PUBLIC_SITE_URL: ${{ secrets.NUXT_PUBLIC_SITE_URL }}

- name: Deploy to Netlify
uses: netlify/actions/cli@master
with:
args: deploy --dir=.output/public --prod
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}

0 comments on commit e666563

Please sign in to comment.