cloudflare release #1
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: cloudflare release | |
| on: | |
| push: | |
| tags: | |
| - 'v*.*.*' | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: Manual tag to publish (e.g. v0.1.0) | |
| required: false | |
| default: '' | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: pnpm/action-setup@v4 | |
| with: | |
| version: latest | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: latest | |
| - run: pnpm install --no-frozen-lockfile | |
| - name: Build Cloudflare Worker bundle | |
| run: pnpm run build:worker | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: cloudflare-worker | |
| path: dist/worker | |
| deploy: | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: cloudflare-worker | |
| path: dist/worker | |
| - name: Pack _worker.zip for Pages direct-upload | |
| run: | | |
| worker_file=$(find dist/worker -name '*worker*.js' -type f) | |
| if [ -z "$worker_file" ]; then | |
| echo "Error: No worker file found" | |
| exit 1 | |
| fi | |
| echo "Found worker file: $worker_file" | |
| zip -j _worker.zip "$worker_file" | |
| mv _worker.zip dist/worker/ | |
| - name: List contents of dist/worker | |
| run: ls -al dist/worker | |
| - name: Deploy to release branch | |
| uses: peaceiris/actions-gh-pages@v4 | |
| with: | |
| github_token: ${{ secrets.DEPLOY_TOKEN }} | |
| publish_dir: dist/worker | |
| publish_branch: release | |
| keep_files: false | |
| enable_jekyll: true |