Push up #841
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: Deploy Cloudflare Worker | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - 'index.js' | |
| - 'wrangler.toml' | |
| permissions: | |
| contents: read | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set Worker Secrets | |
| env: | |
| CF_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| SPICY_SAUCE: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| TACO_BELL: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
| BRAIN_JUICE: ${{ secrets.OPENROUTER_API_KEY }} | |
| SECRET_SAUCE: ${{ secrets.ADMIN_KEY }} | |
| ALERT_SIREN: ${{ secrets.DISCORD_WEBHOOK_URL }} | |
| SCAN_MASTER: ${{ secrets.VIRUSTOTAL_API_KEY }} | |
| GUEST_LIST: ${{ secrets.ALLOWED_ORIGINS }} | |
| WATCH_LIST: ${{ secrets.CRED_I }} | |
| run: | | |
| CF_ACCOUNT=$(curl -s -H "Authorization: Bearer $CF_API_TOKEN" \ | |
| "https://api.cloudflare.com/client/v4/accounts" | jq -r '.result[0].id') | |
| SCRIPT_NAME="acreetionos-worker" | |
| for name in SPICY_SAUCE TACO_BELL BRAIN_JUICE SECRET_SAUCE ALERT_SIREN SCAN_MASTER GUEST_LIST WATCH_LIST; do | |
| val="${!name}" | |
| if [ -n "$val" ]; then | |
| curl -s -X PUT "https://api.cloudflare.com/client/v4/accounts/$CF_ACCOUNT/workers/scripts/$SCRIPT_NAME/secrets" \ | |
| -H "Authorization: Bearer $CF_API_TOKEN" \ | |
| -H "Content-Type: application/json" \ | |
| -d "{\"name\":\"$name\",\"text\":\"$val\"}" | |
| fi | |
| done | |
| - name: Deploy Worker | |
| uses: cloudflare/wrangler-action@v3 | |
| with: | |
| apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} |