merge: 优化文档 #37
This file contains 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: Deploy to Cloudflare Workers | |
on: | |
push: | |
branches: [ "master" ] | |
workflow_dispatch: | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
name: Deploy | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
- run: touch wrangler.toml | |
- run: | | |
cat << 'EOF' > wrangler.toml | |
${{secrets.WRANGLER_TOML}} | |
EOF | |
- run: npm install | |
- run: CLOUDFLARE_API_TOKEN=${{ secrets.CF_API_TOKEN }} npm run wrangler publish --config=wrangler.toml > /dev/null | |
- name: Check CF_WORKERS_DOMAIN exists | |
run: | | |
url=${{ secrets.CF_WORKERS_DOMAIN }} | |
if [ -z "$url" ]; then | |
echo "CF_WORKERS_DOMAIL does not exist" | |
else | |
echo "CF_WORKERS_DOMAIN exists" | |
curl -s -o /dev/null https://$url/init | |
fi |