HelpLogin
© 2022-2025 Spice AI, Inc.
SQL Query ReferenceDocsFAQSupport
PrivacyTerms
Status
Home
Datasets
Models
trunk
Edit on GitHub
Fork
/docs/.github/workflows/build_and_publish.yml
1name: build_and_publish
2
3on:
4 push:
5 branches:
6 - trunk
7 tags:
8 - v*
9 pull_request:
10 workflow_dispatch:
11
12permissions:
13 contents: write
14 deployments: write
15 pull-requests: write
16
17jobs:
18 deploy:
19 runs-on: ubuntu-latest
20 name: Deploy
21 permissions:
22 contents: write
23 deployments: write
24 pull-requests: write
25 steps:
26 - uses: actions/checkout@v4
27 with:
28 fetch-depth: 0
29
30 - uses: actions/setup-node@v4
31 with:
32 node-version: 18
33
34 - name: Install dependencies
35 working-directory: website
36 run: npm install
37
38 - name: Build website
39 working-directory: website
40 run: npm run build
41
42 - name: Can Deploy?
43 id: can_deploy
44 run: |
45 if [[ "${{ secrets.CLOUDFLARE_API_TOKEN }}" == "" || "${{ secrets.CLOUDFLARE_ACCOUNT_ID }}" == "" ]]; then
46 echo "CLOUDFLARE_API_TOKEN or CLOUDFLARE_ACCOUNT_ID is not set. Skipping deployment."
47 echo "can_deploy=false" >> $GITHUB_OUTPUT
48 else
49 echo "can_deploy=true" >> $GITHUB_OUTPUT
50 fi
51
52 - name: Deploy
53 id: deploy
54 if: ${{ steps.can_deploy.outputs.can_deploy == 'true' }}
55 uses: cloudflare/wrangler-action@v3.14.1
56 with:
57 workingDirectory: website
58 apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
59 accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
60 command: pages deploy build --project-name=spiceai-org-website --branch ${{ github.ref_name }}
61 gitHubToken: ${{ secrets.GITHUB_TOKEN }}
62
63 - name: Add deploy comment to PR
64 if: ${{ github.event_name == 'pull_request' && steps.can_deploy.outputs.can_deploy == 'true' }}
65 uses: actions/github-script@v7
66 with:
67 script: |
68 github.rest.issues.createComment({
69 issue_number: context.issue.number,
70 owner: context.repo.owner,
71 repo: context.repo.repo,
72 body: '🚀 deployed to <${{ steps.deploy.outputs.deployment-url }}>'
73 })
74
75 - name: Trigger search reindex after deployment
76 if: ${{ github.ref == 'refs/heads/trunk' }}
77 run: |
78 curl -X POST "https://crawler.algolia.com/api/1/crawlers/${{ secrets.ALGOLIA_CRAWLER_ID }}/reindex" \
79 --user "${{ secrets.ALGOLIA_USER_ID }}":"${{ secrets.ALGOLIA_TOKEN }}"
80
1name: build_and_publish
2
3on:
4 push:
5 branches:
6 - trunk
7 tags:
8 - v*
9 pull_request:
10 workflow_dispatch:
11
12permissions:
13 contents: write
14 deployments: write
15 pull-requests: write
16
17jobs:
18 deploy:
19 runs-on: ubuntu-latest
20 name: Deploy
21 permissions:
22 contents: write
23 deployments: write
24 pull-requests: write
25 steps:
26 - uses: actions/checkout@v4
27 with:
28 fetch-depth: 0
29
30 - uses: actions/setup-node@v4
31 with:
32 node-version: 18
33
34 - name: Install dependencies
35 working-directory: website
36 run: npm install
37
38 - name: Build website
39 working-directory: website
40 run: npm run build
41
42 - name: Can Deploy?
43 id: can_deploy
44 run: |
45 if [[ "${{ secrets.CLOUDFLARE_API_TOKEN }}" == "" || "${{ secrets.CLOUDFLARE_ACCOUNT_ID }}" == "" ]]; then
46 echo "CLOUDFLARE_API_TOKEN or CLOUDFLARE_ACCOUNT_ID is not set. Skipping deployment."
47 echo "can_deploy=false" >> $GITHUB_OUTPUT
48 else
49 echo "can_deploy=true" >> $GITHUB_OUTPUT
50 fi
51
52 - name: Deploy
53 id: deploy
54 if: ${{ steps.can_deploy.outputs.can_deploy == 'true' }}
55 uses: cloudflare/wrangler-action@v3.14.1
56 with:
57 workingDirectory: website
58 apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
59 accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
60 command: pages deploy build --project-name=spiceai-org-website --branch ${{ github.ref_name }}
61 gitHubToken: ${{ secrets.GITHUB_TOKEN }}
62
63 - name: Add deploy comment to PR
64 if: ${{ github.event_name == 'pull_request' && steps.can_deploy.outputs.can_deploy == 'true' }}
65 uses: actions/github-script@v7
66 with:
67 script: |
68 github.rest.issues.createComment({
69 issue_number: context.issue.number,
70 owner: context.repo.owner,
71 repo: context.repo.repo,
72 body: '🚀 deployed to <${{ steps.deploy.outputs.deployment-url }}>'
73 })
74
75 - name: Trigger search reindex after deployment
76 if: ${{ github.ref == 'refs/heads/trunk' }}
77 run: |
78 curl -X POST "https://crawler.algolia.com/api/1/crawlers/${{ secrets.ALGOLIA_CRAWLER_ID }}/reindex" \
79 --user "${{ secrets.ALGOLIA_USER_ID }}":"${{ secrets.ALGOLIA_TOKEN }}"
80