Delete .github/workflows/ci.yml #13
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: Sync to Pages and Functions | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths-ignore: | |
| - "**.md" | |
| - "LICENSE" | |
| - ".gitignore" | |
| - ".editorconfig" | |
| - ".vscode/**" | |
| - "docs/**" | |
| - ".prettierrc*" | |
| - ".eslintrc*" | |
| - ".github/ISSUE_TEMPLATE/**" | |
| - ".github/PULL_REQUEST_TEMPLATE/**" | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: false | |
| jobs: | |
| convert-and-sync-pages: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout main branch | |
| uses: actions/checkout@v6 | |
| with: | |
| ref: main | |
| fetch-depth: 0 | |
| - name: Configure Git | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| - name: Setup adapter files | |
| run: | | |
| mkdir -p /tmp/pages-conversion | |
| cp -r adapters/pages/* /tmp/pages-conversion/ | |
| - name: Copy source code files | |
| run: | | |
| cp -r src /tmp/pages-conversion/ | |
| cp package.json /tmp/pages-conversion/ | |
| cp package-lock.json /tmp/pages-conversion/ 2>/dev/null || true | |
| cp LICENSE /tmp/pages-conversion/ | |
| - name: Export handleRequest from src/index.js | |
| run: | | |
| cd /tmp/pages-conversion | |
| # Add export statement before the default export at the end of the file | |
| sed -i '/^export default {$/i\ | |
| export { handleRequest };' src/index.js | |
| - name: Update package.json for Pages | |
| run: | | |
| cd /tmp/pages-conversion | |
| # Update deployment commands to use Pages | |
| cat package.json | \ | |
| sed 's/"deploy": "wrangler deploy"/"deploy": "wrangler pages deploy ."/' | \ | |
| sed 's/"start": "wrangler dev"/"start": "wrangler pages dev ."/' \ | |
| > package.json.tmp && mv package.json.tmp package.json | |
| - name: Initialize pages branch | |
| run: | | |
| cd /tmp/pages-conversion | |
| git init | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git checkout -b pages | |
| git add . | |
| git commit -m "Convert Workers to Pages | |
| Auto-converted from main branch commit ${{ github.sha }} | |
| Runtime files only (documentation, tests, and dev configs excluded)." | |
| - name: Force push to pages branch | |
| run: | | |
| cd /tmp/pages-conversion | |
| git remote add origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git | |
| git push -f origin pages | |
| - name: Clean up | |
| if: always() | |
| run: | | |
| rm -rf /tmp/pages-conversion | |
| convert-and-sync-functions: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout main branch | |
| uses: actions/checkout@v6 | |
| with: | |
| ref: main | |
| fetch-depth: 0 | |
| - name: Configure Git | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| - name: Setup adapter files | |
| run: | | |
| mkdir -p /tmp/functions-conversion | |
| # Copy all content from adapters/functions excluding package.json first | |
| cp -r adapters/functions/* /tmp/functions-conversion/ | |
| # Copy the specific package.json for functions (overwriting if needed, but we do it later anyway) | |
| - name: Copy source code files | |
| run: | | |
| # Copy only runtime-required files | |
| cp -r src /tmp/functions-conversion/ | |
| # Note: We do NOT copy the root package.json here as we use the one from adapters/functions | |
| cp package-lock.json /tmp/functions-conversion/ 2>/dev/null || true | |
| cp LICENSE /tmp/functions-conversion/ | |
| - name: Export handleRequest from src/index.js | |
| run: | | |
| cd /tmp/functions-conversion | |
| # Add export statement before the default export at the end of the file | |
| sed -i '/^export default {$/i\ | |
| export { handleRequest };' src/index.js | |
| - name: Initialize functions branch | |
| run: | | |
| cd /tmp/functions-conversion | |
| git init | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git checkout -b functions | |
| git add . | |
| git commit -m "Convert Workers to Functions | |
| Auto-converted from main branch commit ${{ github.sha }} | |
| Runtime files only (documentation, tests, and dev configs excluded)." | |
| - name: Force push to functions branch | |
| run: | | |
| cd /tmp/functions-conversion | |
| git remote add origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git | |
| git push -f origin functions | |
| - name: Clean up | |
| if: always() | |
| run: | | |
| rm -rf /tmp/functions-conversion |