File tree 2 files changed +47
-2
lines changed
2 files changed +47
-2
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ # Check if an argument is provided
4
+ if [ $# -eq 0 ]; then
5
+ echo " Error: Please provide a version string as an argument."
6
+ exit 1
7
+ fi
8
+
9
+ inputString=$1
10
+
11
+ # Check if VERCEL_TOKEN is set
12
+ if [ -z " $VERCEL_TOKEN " ]; then
13
+ echo " Error: VERCEL_TOKEN is not set."
14
+ exit 1
15
+ fi
16
+
17
+ # save stdout and stderr to files
18
+ vercel deploy --prebuilt --token=" $VERCEL_TOKEN " > deployment-url.txt 2> error.txt
19
+
20
+ # check the exit code
21
+ code=$?
22
+ if [ $code -eq 0 ]; then
23
+ # Set the deploymentUrl using the input string
24
+ deploymentUrl=" ${inputString} .api.js.langchain.com"
25
+ vercel alias $( cat deployment-url.txt) $deploymentUrl --token=" $VERCEL_TOKEN " --scope=" langchain"
26
+ else
27
+ # Handle the error
28
+ errorMessage=$( cat error.txt)
29
+ echo " There was an error: $errorMessage "
30
+ fi
Original file line number Diff line number Diff line change 34
34
- name : Build All Projects
35
35
run : yarn turbo:command build --filter=!examples --filter=!api_refs --filter=!core_docs --filter=!create-langchain-integration
36
36
- name : Build Project Artifacts
37
- run : vercel build --prod --token=${{ secrets.VERCEL_TOKEN }}
37
+ run : |
38
+ if [ ${{ github.ref }} = 'refs/heads/main' ]; then
39
+ vercel build --prod --token=${{ secrets.VERCEL_TOKEN }}
40
+ else
41
+ vercel build --token=${{ secrets.VERCEL_TOKEN }}
42
+ fi
38
43
- name : Deploy to Vercel
39
- run : vercel deploy --prod --prebuilt --token=${{ secrets.VERCEL_TOKEN }}
44
+ env :
45
+ VERCEL_TOKEN : ${{ secrets.VERCEL_TOKEN }}
46
+ run : |
47
+ if [ ${{ github.ref }} = 'refs/heads/main' ]; then
48
+ vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }}
49
+ elif [ ${{ github.ref }} = 'refs/heads/v0.2' ]; then
50
+ .github/scripts/deployDomainVercel.sh v02
51
+ else
52
+ echo "Error: Deployment is only allowed for 'main' or 'v0.2' branches."
53
+ exit 1
54
+ fi
You can’t perform that action at this time.
0 commit comments