Add official GitHub Pages workflow #3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy Web Interface to GitHub Pages | |
on: | |
push: | |
branches: [ main, master ] | |
paths: | |
- 'web/**' | |
- '.github/workflows/deploy-web.yml' | |
pull_request: | |
branches: [ main, master ] | |
paths: | |
- 'web/**' | |
workflow_dispatch: | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Node.js (optional) | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '18' | |
cache: 'npm' | |
cache-dependency-path: web/package.json | |
- name: Install dependencies (optional) | |
run: | | |
cd web | |
npm ci --only=dev || echo "No dependencies to install" | |
- name: Verify web source files | |
run: | | |
echo "Checking web source files..." | |
ls -la web/src/ | |
echo "✅ Web source files found" | |
- name: Build web interface | |
run: | | |
cd web | |
npm run build || (mkdir -p dist && cp -r src/* dist/) | |
# Copy built files to docs for GitHub Pages | |
mkdir -p ../docs | |
cp -r dist/* ../docs/ || cp -r src/* ../docs/ | |
# Verify files were copied | |
echo "Files copied to docs directory:" | |
ls -la ../docs/ | |
echo "✅ Web interface built successfully" | |
- name: Deploy to GitHub Pages | |
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' | |
uses: peaceiris/actions-gh-pages@v4 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./docs | |
publish_branch: gh-pages | |
user_name: 'github-actions[bot]' | |
user_email: 'github-actions[bot]@users.noreply.github.com' | |
- name: Create deployment summary | |
run: | | |
echo "## 🚀 Deployment Summary" >> $GITHUB_STEP_SUMMARY | |
echo "" >> $GITHUB_STEP_SUMMARY | |
echo "✅ Web interface deployed to GitHub Pages" >> $GITHUB_STEP_SUMMARY | |
echo "" >> $GITHUB_STEP_SUMMARY | |
echo "🌐 **Live URL**: https://${{ github.repository_owner }}.github.io/transcript-ai" >> $GITHUB_STEP_SUMMARY | |
echo "" >> $GITHUB_STEP_SUMMARY | |
echo "📁 **Source**: \`web/src/\`" >> $GITHUB_STEP_SUMMARY | |
echo "📁 **Deployed**: \`docs/\` → \`gh-pages\` branch" >> $GITHUB_STEP_SUMMARY | |
echo "" >> $GITHUB_STEP_SUMMARY | |
echo "🔧 **Technology**: Vanilla HTML/CSS/JavaScript" >> $GITHUB_STEP_SUMMARY |