refactor: Replace forEach loops with for...of for improved readab…
#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: release-api.yml | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - master | |
| paths: | |
| - 'apps/api-cloudflare-worker/**' | |
| - '.github/workflows/release-api.yml' ##This file, any change, need to update | |
| - 'scripts/prep-wrangler-jsonc.mjs' ## Any change in the script file | |
| jobs: | |
| deploy-worker: | |
| name: "Release API to cloudflare worker" | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v3 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v2 | |
| with: | |
| version: 8 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: '20' | |
| cache: 'pnpm' | |
| - name: Install Dependencies | |
| run: pnpm install | |
| - name: Run preDeploySetup | |
| run: | | |
| FILE_PATH=apps/api-cloudflare-worker \ | |
| TARGET_EMAIL=${{ secrets.TARGET_EMAIL }} \ | |
| SOURCE_EMAIL=${{ secrets.SOURCE_EMAIL }} \ | |
| STORE_ID=${{ secrets.STORE_ID }} \ | |
| ROUTE_DOMAIN=${{ secrets.ROUTE_DOMAIN }} \ | |
| FROM_EMAIL=${{ secrets.FROM_EMAIL }} \ | |
| node scripts/prep-wrangler-jsonc.mjs | |
| - name: Deploy to Cloudflare | |
| uses: cloudflare/wrangler-action@v3 | |
| with: | |
| apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
| workingDirectory: 'apps/api-cloudflare-worker' |