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
28 - uses: actions/setup-node@v4
29 with:
30 node-version: 24
31
32 - name: Install dependencies
33 working-directory: website
34 run: npm install
35
36 - name: Build website
37 working-directory: website
38 run: npm run build
39
40 - name: Can Deploy?
41 id: can_deploy
42 run: |
43 if [[ "${{ secrets.CLOUDFLARE_API_TOKEN }}" == "" || "${{ secrets.CLOUDFLARE_ACCOUNT_ID }}" == "" ]]; then
44 echo "CLOUDFLARE_API_TOKEN or CLOUDFLARE_ACCOUNT_ID is not set. Skipping deployment."
45 echo "can_deploy=false" >> $GITHUB_OUTPUT
46 else
47 echo "can_deploy=true" >> $GITHUB_OUTPUT
48 fi
49
50 - name: Deploy
51 id: deploy
52 if: ${{ steps.can_deploy.outputs.can_deploy == 'true' }}
53 uses: cloudflare/wrangler-action@v3.14.1
54 with:
55 workingDirectory: website
56 apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
57 accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
58 command: pages deploy build --project-name=spiceai-org-website --branch ${{ github.ref_name }}
59 gitHubToken: ${{ secrets.GITHUB_TOKEN }}
60
61 - name: Add deploy comment to PR
62 if: ${{ github.event_name == 'pull_request' && steps.can_deploy.outputs.can_deploy == 'true' }}
63 uses: actions/github-script@v7
64 with:
65 script: |
66 github.rest.issues.createComment({
67 issue_number: context.issue.number,
68 owner: context.repo.owner,
69 repo: context.repo.repo,
70 body: '🚀 deployed to <${{ steps.deploy.outputs.deployment-url }}>'
71 })
72
73 - name: Trigger search reindex after deployment
74 if: ${{ github.ref == 'refs/heads/trunk' }}
75 run: |
76 curl -X POST "https://crawler.algolia.com/api/1/crawlers/${{ secrets.ALGOLIA_CRAWLER_ID }}/reindex" \
77 --user "${{ secrets.ALGOLIA_USER_ID }}":"${{ secrets.ALGOLIA_TOKEN }}"
78
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
28 - uses: actions/setup-node@v4
29 with:
30 node-version: 24
31
32 - name: Install dependencies
33 working-directory: website
34 run: npm install
35
36 - name: Build website
37 working-directory: website
38 run: npm run build
39
40 - name: Can Deploy?
41 id: can_deploy
42 run: |
43 if [[ "${{ secrets.CLOUDFLARE_API_TOKEN }}" == "" || "${{ secrets.CLOUDFLARE_ACCOUNT_ID }}" == "" ]]; then
44 echo "CLOUDFLARE_API_TOKEN or CLOUDFLARE_ACCOUNT_ID is not set. Skipping deployment."
45 echo "can_deploy=false" >> $GITHUB_OUTPUT
46 else
47 echo "can_deploy=true" >> $GITHUB_OUTPUT
48 fi
49
50 - name: Deploy
51 id: deploy
52 if: ${{ steps.can_deploy.outputs.can_deploy == 'true' }}
53 uses: cloudflare/wrangler-action@v3.14.1
54 with:
55 workingDirectory: website
56 apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
57 accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
58 command: pages deploy build --project-name=spiceai-org-website --branch ${{ github.ref_name }}
59 gitHubToken: ${{ secrets.GITHUB_TOKEN }}
60
61 - name: Add deploy comment to PR
62 if: ${{ github.event_name == 'pull_request' && steps.can_deploy.outputs.can_deploy == 'true' }}
63 uses: actions/github-script@v7
64 with:
65 script: |
66 github.rest.issues.createComment({
67 issue_number: context.issue.number,
68 owner: context.repo.owner,
69 repo: context.repo.repo,
70 body: '🚀 deployed to <${{ steps.deploy.outputs.deployment-url }}>'
71 })
72
73 - name: Trigger search reindex after deployment
74 if: ${{ github.ref == 'refs/heads/trunk' }}
75 run: |
76 curl -X POST "https://crawler.algolia.com/api/1/crawlers/${{ secrets.ALGOLIA_CRAWLER_ID }}/reindex" \
77 --user "${{ secrets.ALGOLIA_USER_ID }}":"${{ secrets.ALGOLIA_TOKEN }}"
78