diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 0bf6435..340169c 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -26,12 +26,11 @@ jobs: deploy: runs-on: ubuntu-latest needs: test - if: github.ref == 'refs/heads/main' - environment: production + environment: {{ github.ref == 'refs/heads/main' && 'production' || 'staging' }} steps: - uses: actions/checkout@v4 - name: Deploy - run: npx wrangler deploy + run: {{ github.ref == 'refs/heads/main' && 'npx wrangler deploy' || ' npx wranger deploy -e staging' }} env: CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} diff --git a/wrangler.toml b/wrangler.toml index 2cf3e7e..463e3cf 100644 --- a/wrangler.toml +++ b/wrangler.toml @@ -4,4 +4,9 @@ compatibility_date = "2024-03-04" compatibility_flags = ["nodejs_compat"] routes = [ { pattern = "www.cinotify.cc/api/*", zone_id = "8b83258726802e1e77310bd3b08dfefa" } +] + +[env.staging] +routes = [ + { pattern = "staging.cinotify.cc/api/*", zone_id = "8b83258726802e1e77310bd3b08dfefa" } ] \ No newline at end of file