Deploy to Cloudflare Workers #32
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: | |
schedule: | |
- cron: "30 10 * * 2" | |
workflow_dispatch: | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
- run: npm install | |
- run: ./import-geoip.sh | |
env: | |
MAXMIND_ACCOUNT_ID : ${{ secrets.MAXMIND_ACCOUNT_ID }} | |
MAXMIND_LICENSE_KEY : ${{ secrets.MAXMIND_LICENSE_KEY }} | |
CLOUDFLARE_ACCOUNT_ID : ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
CLOUDFLARE_API_TOKEN : ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
UPSTREAM_ENDPOINT : ${{ secrets.UPSTREAM_ENDPOINT }} | |
- run: mv tmp/wrangler.toml . | |
- run: npm run deploy | |
env: | |
CLOUDFLARE_ACCOUNT_ID : ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
CLOUDFLARE_API_TOKEN : ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
- name: Update release | |
run: | | |
mkdir release && cd release | |
DATE=`date` | |
echo $DATE >release | |
git init | |
git config --local user.name "github-actions[bot]" | |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git checkout -b release | |
git add -A | |
git commit -m "$DATE" | |
git remote add origin "https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}" | |
git push -f -u origin release | |