Skip to content

.github/workflows/update_cf_url.yml #9

.github/workflows/update_cf_url.yml

.github/workflows/update_cf_url.yml #9

Workflow file for this run

on:
release:
types:
- published
jobs:
update_url:
runs-on: ubuntu-latest
steps:
- run: |
RELEASE_ID=${{ github.event.release.id }}
NEW_URL_PATTERN='https://pacman.kovacsmiki.com/x86_64/*'
NEW_SETTINGS="{\"forwarding_url\": {\"url\": \"https://github.com/mortyr45/pacman-repository/releases/download/${{ github.event.release.name }}/\$1\", \"status_code\": 301}}"
DATA="{\"targets\": [{\"target\": \"url\", \"constraint\": {\"operator\": \"matches\", \"value\": \"$NEW_URL_PATTERN\"}}], \"actions\": [\"$NEW_SETTINGS\"], \"priority\": 1, \"status\": \"active\"}"
curl -X PUT "https://api.cloudflare.com/client/v4/zones/${{ secrets.CF_ZONE_ID }}/pagerules/${{ secrets.CF_PAGE_RULE_ID }}" \
-H "X-Auth-Key: ${{ secrets.CF_API_TOKEN }}" \
-H "Content-Type: application/json" \
--data "$DATA"