Commit 2936463 1 parent 1db75bc commit 2936463 Copy full SHA for 2936463
File tree 3 files changed +66
-14
lines changed
3 files changed +66
-14
lines changed Original file line number Diff line number Diff line change
1
+ # Vercel Preview
2
+ #
3
+ # References:
4
+ #
5
+ # - https://docs.github.com/actions/using-workflows/events-that-trigger-workflows#pull_request
6
+ # - https://docs.github.com/actions/using-workflows/events-that-trigger-workflows#push
7
+ # - https://docs.github.com/actions/using-workflows/events-that-trigger-workflows#workflow_dispatch
8
+ # - https://github.com/actions/checkout
9
+ # - https://vercel.com/guides/how-can-i-use-github-actions-with-vercel
10
+
11
+ ---
12
+ name : preview
13
+ on :
14
+ pull_request :
15
+ branches :
16
+ - main
17
+ push :
18
+ branches :
19
+ - feat/**
20
+ - hotfix/**
21
+ - main
22
+ paths :
23
+ - .vercelignore
24
+ - docs/**
25
+ - vercel.json
26
+ workflow_dispatch :
27
+ permissions :
28
+ packages : read
29
+ env :
30
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
31
+ HUSKY : 0
32
+ REF : ${{ github.head_ref || github.ref_name }}
33
+ VERCEL_ORG_ID : ${{ secrets.VERCEL_ORG_ID }}
34
+ VERCEL_PROJECT_ID : ${{ secrets.VERCEL_PROJECT_ID }}
35
+ concurrency :
36
+ group : ${{ github.workflow }}-${{ github.ref }}
37
+ cancel-in-progress : true
38
+ jobs :
39
+ preview :
40
+ if : |
41
+ github.actor != 'dependabot[bot]' && !startsWith(github.event.head_commit.message, 'release:')
42
+ runs-on : ubuntu-latest
43
+ environment : preview
44
+ steps :
45
+ - id : checkout
46
+ name : Checkout ${{ env.REF }}
47
+ uses : actions/checkout@v3.1.0
48
+ with :
49
+ ref : ${{ env.REF }}
50
+ - id : install
51
+ name : Install Vercel CLI
52
+ run : npm install --global vercel@latest
53
+ - id : env
54
+ name : Pull environment
55
+ run : vc pull --environment=preview --yes --token=${{ secrets.VERCEL_TOKEN }}
56
+ - id : build
57
+ name : Build docs
58
+ run : vc build --token=${{ secrets.VERCEL_TOKEN }}
59
+ - id : deploy
60
+ name : Deploy docs preview
61
+ run : vc deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }}
Original file line number Diff line number Diff line change @@ -27,18 +27,9 @@ const {
27
27
ALGOLIA_API_KEY = '' ,
28
28
HOSTNAME = '' ,
29
29
NODE_ENV ,
30
- VERCEL_ENV ,
31
- VERCEL_URL = ''
30
+ VERCEL_ENV
32
31
} = process . env
33
32
34
- /**
35
- * Site url.
36
- *
37
- * @const {string} SITE_URL
38
- */
39
- const SITE_URL : string =
40
- VERCEL_ENV === 'preview' ? VERCEL_URL || HOSTNAME : HOSTNAME
41
-
42
33
/**
43
34
* GitHub repository url.
44
35
*
@@ -86,7 +77,7 @@ const config: UserConfig = defineConfig({
86
77
*
87
78
* @var {SitemapStream} stream
88
79
*/
89
- let stream : SitemapStream = new SitemapStream ( { hostname : SITE_URL } )
80
+ let stream : SitemapStream = new SitemapStream ( { hostname : HOSTNAME } )
90
81
91
82
/**
92
83
* Sitemap routes.
@@ -191,9 +182,9 @@ const config: UserConfig = defineConfig({
191
182
*/
192
183
const url : string =
193
184
pageData . relativePath === 'index.md'
194
- ? SITE_URL
185
+ ? HOSTNAME
195
186
: path
196
- . join ( SITE_URL , pageData . relativePath )
187
+ . join ( HOSTNAME , pageData . relativePath )
197
188
. replace ( / \. m d $ / , '.html' )
198
189
. replace ( / i n d e x \. h t m l $ / , '' )
199
190
Original file line number Diff line number Diff line change 5
5
"devCommand" : " vitepress dev docs" ,
6
6
"framework" : " vite" ,
7
7
"ignoreCommand" : null ,
8
- "installCommand" : null ,
8
+ "installCommand" : " yarn --immutable " ,
9
9
"github" : {
10
10
"autoJobCancelation" : true ,
11
11
"enabled" : false ,
You can’t perform that action at this time.
0 commit comments