-
Notifications
You must be signed in to change notification settings - Fork 15
158 lines (130 loc) · 4.01 KB
/
ci.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
name: CI
on:
push:
branches:
- main
tags:
- '*'
pull_request:
env:
PATH_BUILD_DOCS: ./apps/docs/pages/.vitepress/dist
PATH_BUILD_WEB: ./apps/web/dist
PATH_BUILD_WEB_FUNCTIONS: ./apps/web/.netlify/functions-internal
PATH_BUILD_UI: ./packages/ui/.histoire/dist
CACHE_PATHS_BUILD: |
./apps/docs/pages/.vitepress/dist
./apps/web/.netlify
./apps/web/dist
./packages/ui/.histoire/dist
CACHE_KEY_BUILD: build-${{ github.sha }}
# To use Remote Caching, uncomment the next lines and follow the steps below.
# TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
# TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
jobs:
build:
name: Build 🏗️
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup
uses: ./.github/workflows/setup
- name: Build
run: pnpm build
- name: Cache build
uses: actions/cache@v3
with:
path: ${{ env.CACHE_PATHS_BUILD }}
key: ${{ env.CACHE_KEY_BUILD }}
lint:
name: Lint ✅
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup
uses: ./.github/workflows/setup
- name: Lint
run: pnpm lint
test:
name: Test 🧪
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup
uses: ./.github/workflows/setup
- name: Test
run: pnpm test
deploy-docs-main:
name: Deploy docs from main branch 🚀
needs: [build, lint, test]
runs-on: ubuntu-latest
if: github.ref_type == 'tag'
environment:
name: Docs (main)
url: https://turborepo-nuxt-boilerplate-docs-main.netlify.app/
steps:
- uses: actions/cache@v3
with:
path: ${{ env.CACHE_PATHS_BUILD }}
key: ${{ env.CACHE_KEY_BUILD }}
- uses: nwtgck/[email protected]
with:
publish-dir: ${{ env.PATH_BUILD_DOCS }}
production-deploy: true
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID_DOCS_MAIN }}
deploy-web-main:
name: Deploy web app from main branch 🚀
needs: [build, lint, test]
runs-on: ubuntu-latest
if: github.ref_type == 'tag'
environment:
name: Web (main)
url: https://turborepo-nuxt-boilerplate-web-main.netlify.app/
steps:
- uses: actions/cache@v3
with:
path: ${{ env.CACHE_PATHS_BUILD }}
key: ${{ env.CACHE_KEY_BUILD }}
# Doesn't work
# - uses: nwtgck/[email protected]
# with:
# publish-dir: ${{ env.PATH_BUILD_WEB }}
# functions-dir: ${{ env.PATH_BUILD_WEB_FUNCTIONS }}
# production-deploy: true
# env:
# NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
# NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID_UI_MAIN }}
# Using netlify CLI https://github.com/nuxt/framework/issues/4439
- name: Deploy to Netlify using their CLI
uses: netlify/actions/cli@master
with:
args: deploy --dir=${{ env.PATH_BUILD_WEB }} --functions=${{ env.PATH_BUILD_WEB_FUNCTIONS }} -p
env:
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID_WEB_MAIN }}
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
deploy-ui-main:
name: Deploy UI from main branch 🚀
needs: [build, lint, test]
runs-on: ubuntu-latest
if: github.ref_type == 'tag'
environment:
name: UI (main)
url: https://turborepo-nuxt-boilerplate-ui-main.netlify.app/
steps:
- uses: actions/cache@v3
with:
path: ${{ env.CACHE_PATHS_BUILD }}
key: ${{ env.CACHE_KEY_BUILD }}
- uses: nwtgck/[email protected]
with:
publish-dir: ${{ env.PATH_BUILD_UI }}
production-deploy: true
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID_UI_MAIN }}