name: Deploy to GitHub Pages permissions: contents: write on: workflow_dispatch: push: branches: - main jobs: deploy: name: Deploy to GitHub Pages runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v4 - name: Set up Bun uses: oven-sh/setup-bun@v1 with: bun-version: latest - name: Install dependencies run: bun install --frozen-lockfile - name: Build project run: bun --bun run build - name: Ensure deploy branch exists run: | git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" if ! git ls-remote --exit-code --heads origin gh-pages; then git checkout --orphan gh-pages git rm -rf . git commit --allow-empty -m "Initialize gh-pages branch" git push origin gh-pages git checkout main fi - name: Deploy to extra branch uses: peaceiris/actions-gh-pages@v4 with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./dist publish_branch: gh-pages