Skip to content

Commit 71ac39b

Browse files
committed
feat: Add semantic search deployment configuration
1 parent 7b2e020 commit 71ac39b

File tree

3 files changed

+104
-0
lines changed

3 files changed

+104
-0
lines changed

.github/workflows/deploy-branch.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Deploy Branch Preview
2+
on:
3+
push:
4+
branches-ignore:
5+
- main
6+
- develop
7+
pull_request:
8+
branches:
9+
- main
10+
- develop
11+
12+
jobs:
13+
deploy-preview:
14+
runs-on: ubuntu-latest
15+
env:
16+
SEMANTIC_SEARCH_API_URL: ${{ secrets.SEMANTIC_SEARCH_API_URL }}
17+
steps:
18+
- uses: actions/setup-node@v4
19+
with:
20+
node-version: "lts/*"
21+
22+
- uses: actions/checkout@v4
23+
24+
- name: Get branch name
25+
id: branch-name
26+
run: |
27+
if [ "${{ github.event_name }}" = "pull_request" ]; then
28+
echo "branch_name=${{ github.head_ref }}" >> $GITHUB_OUTPUT
29+
else
30+
echo "branch_name=${{ github.ref_name }}" >> $GITHUB_OUTPUT
31+
fi
32+
33+
- name: Install dependencies
34+
run: npm install
35+
36+
- name: Build for preview
37+
run: npm run build -- --pathPrefix="/stac-browser-preview/${{ steps.branch-name.outputs.branch_name }}" --historyMode=hash --semanticSearchApiUrl="${{ env.SEMANTIC_SEARCH_API_URL }}"
38+
39+
- name: Deploy to GitHub Pages
40+
uses: peaceiris/actions-gh-pages@v3
41+
with:
42+
github_token: ${{ secrets.GITHUB_TOKEN }}
43+
publish_dir: dist
44+
exclude_assets: "report.html"
45+
user_name: "STAC Browser CI"
46+
user_email: [email protected]
47+
destination_dir: preview/${{ steps.branch-name.outputs.branch_name }}
48+
49+
- name: Comment PR
50+
if: github.event_name == 'pull_request'
51+
uses: actions/github-script@v7
52+
with:
53+
script: |
54+
const url = `https://${{ github.repository_owner }}.github.io/${{ github.repository }}/preview/${{ steps.branch-name.outputs.branch_name }}/`;
55+
github.rest.issues.createComment({
56+
issue_number: context.issue.number,
57+
owner: context.repo.owner,
58+
repo: context.repo.repo,
59+
body: `🚀 **Preview deployed!**\n\nYour changes are now available at: ${url}\n\nThis preview will be automatically updated on each push to this branch.`
60+
});

config.schema.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,10 @@
243243
"$ref": "https://stac-extensions.github.io/authentication/v1.1.0/schema.json"
244244
}
245245
]
246+
},
247+
"semanticSearchApiUrl": {
248+
"type": ["string", "null"],
249+
"format": "uri"
246250
}
247251
}
248252
}

scripts/build-with-semantic.sh

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/bin/bash
2+
3+
# Build script with semantic search API URL
4+
# Usage: ./scripts/build-with-semantic.sh [semantic-api-url] [branch-name]
5+
6+
set -e
7+
8+
# Default values
9+
SEMANTIC_API_URL=${1:-"https://api.stac-semantic-search.k8s.labs.ds.io"}
10+
BRANCH_NAME=${2:-$(git branch --show-current)}
11+
12+
if [ -z "$BRANCH_NAME" ]; then
13+
echo "Error: Could not determine branch name"
14+
exit 1
15+
fi
16+
17+
echo "🚀 Building with semantic search..."
18+
echo " API URL: $SEMANTIC_API_URL"
19+
echo " Branch: $BRANCH_NAME"
20+
echo " Path Prefix: /stac-browser-preview/$BRANCH_NAME"
21+
echo ""
22+
23+
# Build the application
24+
npm run build -- \
25+
--pathPrefix="/stac-browser-preview/$BRANCH_NAME" \
26+
--historyMode=hash \
27+
--semanticSearchApiUrl="$SEMANTIC_API_URL"
28+
29+
echo ""
30+
echo "✅ Build complete!"
31+
echo "📁 Output directory: dist/"
32+
echo ""
33+
echo "To test locally:"
34+
echo " npx serve dist/"
35+
echo ""
36+
echo "To deploy to GitHub Pages:"
37+
echo " 1. Set the SEMANTIC_SEARCH_API_URL secret in your repo settings"
38+
echo " 2. Push this branch to GitHub"
39+
echo " 3. The GitHub Action will deploy to:"
40+
echo " https://YOUR_USERNAME.github.io/YOUR_REPO/preview/$BRANCH_NAME/"

0 commit comments

Comments
 (0)