fix: tambah favicon.ico dari icon.png + referensi di index.html #21
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 Voice Runner to Vercel | |
| on: | |
| push: | |
| branches: [main, master] | |
| pull_request: | |
| branches: [main, master] | |
| # Bisa juga trigger manual dari GitHub UI | |
| workflow_dispatch: | |
| jobs: | |
| # ===== JOB 1: Cek kualitas kode ===== | |
| lint: | |
| name: β Quality Check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: π₯ Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: π Check HTML validity | |
| run: | | |
| # Cek file-file penting ada | |
| if [ ! -f "index.html" ]; then | |
| echo "β index.html not found!" | |
| exit 1 | |
| fi | |
| if [ ! -d "js" ]; then | |
| echo "β js/ directory not found!" | |
| exit 1 | |
| fi | |
| if [ ! -d "css" ]; then | |
| echo "β css/ directory not found!" | |
| exit 1 | |
| fi | |
| echo "β All required files exist" | |
| - name: π§ͺ Check JavaScript syntax | |
| run: | | |
| # Cek syntax JS files with node | |
| for file in js/*.js; do | |
| echo "Checking $file..." | |
| node --check "$file" 2>&1 || { | |
| echo "β Syntax error in $file" | |
| exit 1 | |
| } | |
| done | |
| echo "β All JavaScript files have valid syntax" | |
| - name: π¦ Check file sizes (ZIP limit ~50MB) | |
| run: | | |
| total=0 | |
| echo "=== File sizes ===" | |
| du -sh . --exclude=.git | |
| echo "==================" | |
| largest=$(find . -not -path './.git/*' -type f -exec du -b {} \; | sort -rn | head -5) | |
| echo "Largest files:" | |
| echo "$largest" | |
| # ===== JOB 2: Build + Deploy ke Vercel ===== | |
| deploy: | |
| name: π Deploy to Vercel | |
| needs: lint | |
| permissions: | |
| contents: write # Diperlukan untuk push tag + buat release | |
| # Hanya deploy dari push ke main/master, bukan dari PR | |
| if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: π₯ Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: π¦ Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: β‘ Install Vercel CLI | |
| run: npm install --global vercel@latest | |
| - name: π Pull Vercel Environment Information | |
| run: | | |
| vercel pull \ | |
| --yes \ | |
| --environment=production \ | |
| --token=${{ secrets.VERCEL_TOKEN }} \ | |
| --scope=${{ secrets.VERCEL_ORG_ID || '' }} | |
| - name: ποΈ Build Project Artifacts | |
| run: | | |
| vercel build \ | |
| --prod \ | |
| --token=${{ secrets.VERCEL_TOKEN }} | |
| - name: π Deploy to Vercel | |
| run: | | |
| vercel deploy \ | |
| --prebuilt \ | |
| --prod \ | |
| --token=${{ secrets.VERCEL_TOKEN }} \ | |
| --scope=${{ secrets.VERCEL_ORG_ID || '' }} \ | |
| 2>&1 | tee deploy-output.txt | |
| - name: π Get Deployment URL | |
| id: deploy_url | |
| run: | | |
| echo "### β Deployed to Vercel! π" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "Deployment URL:" >> $GITHUB_STEP_SUMMARY | |
| grep -o 'https://[^ ]*\.vercel\.app' deploy-output.txt | head -1 | \ | |
| while read url; do | |
| echo "- **Production**: [$url]($url)" >> $GITHUB_STEP_SUMMARY | |
| echo "url=$url" >> $GITHUB_OUTPUT | |
| done || echo "- Check Vercel dashboard for URL" >> $GITHUB_STEP_SUMMARY | |
| - name: π·οΈ Buat Git Tag & Release | |
| if: success() | |
| id: create_release | |
| run: | | |
| # Generate version dari tanggal + commit | |
| VERSION="v$(date +'%Y.%m.%d')-$(git rev-parse --short HEAD)" | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| # Buat tag | |
| git tag $VERSION | |
| git push origin $VERSION | |
| echo "β Tag created: $VERSION" | |
| - name: π¦ Build ZIP (Itch.io ready) | |
| if: success() | |
| run: | | |
| # Buat ZIP langsung di workspace root | |
| ZIP_NAME="VoiceRunner-${{ steps.create_release.outputs.version }}.zip" | |
| # File dan folder yang masuk ZIP (exclude .git, .github, dll) | |
| zip -r "$ZIP_NAME" index.html js/ css/ Music/ assets/ vercel.json | |
| # Info ukuran | |
| echo "=== β Build Artifact ===" | |
| ls -lh "$ZIP_NAME" | |
| echo "Total size:" | |
| du -sh "$ZIP_NAME" | |
| echo "======================" | |
| - name: π¦ Publish GitHub Release | |
| if: success() | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ steps.create_release.outputs.version }} | |
| name: "Voice Runner ${{ steps.create_release.outputs.version }}" | |
| files: | | |
| VoiceRunner-*.zip | |
| body: | | |
| ## π Voice Runner ${{ steps.create_release.outputs.version }} | |
| **Commit:** ${{ github.event.head_commit.message || 'Manual trigger' }} | |
| **π Play Online:** ${{ steps.deploy_url.outputs.url || 'Vercel' }} | |
| ### β Changes | |
| ${{ github.event.head_commit.message || 'β' }} | |
| ### π₯ Downloads | |
| | Platform | File | | |
| |----------|------| | |
| | π Web | [Main](${{ steps.deploy_url.outputs.url || '#' }}) | | |
| | π¦ Itch.io | ZIP game (lihat Assets bawah) | | |
| --- | |
| *Auto-generated by GitHub Actions* | |
| draft: false | |
| prerelease: false | |
| generate_release_notes: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: π¬ Send Telegram Notification (optional) | |
| if: always() | |
| uses: appleboy/telegram-action@master | |
| with: | |
| to: ${{ secrets.TELEGRAM_CHAT_ID || '' }} | |
| token: ${{ secrets.TELEGRAM_BOT_TOKEN || '' }} | |
| message: | | |
| Voice Runner ${{ job.status == 'success' && 'β ' || 'β' }} ${{ job.status == 'success' && 'Deployed!' || 'Deploy failed!' }} | |
| ${{ job.status == 'success' && format('Release: v{0}', steps.create_release.outputs.version) || '' }} | |
| Commit: ${{ github.event.head_commit.message || 'Manual trigger' }} | |
| format: markdown | |
| disable_web_page_preview: true | |
| continue-on-error: true |