-
-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (51 loc) · 1.99 KB
/
cloudflare_deploy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
name: Cloudflare Settings Automation
on:
workflow_dispatch: # Allows manual triggering from GitHub Actions UI
schedule:
- cron: '0 0 * * *' # Runs daily at midnight
jobs:
apply-settings:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Create and activate virtual environment
run: |
python -m venv venv
source venv/bin/activate
python -m pip install --upgrade pip
pip install --force-reinstall aiohttp pydantic cloudflare tenacity pyyaml
shell: bash # Ensure the script runs in a bash shell
- name: Verify configuration file
run: |
source venv/bin/activate
if [ ! -f config/cloudflare.yaml ]; then
echo "::error::Configuration file not found at config/cloudflare.yaml"
exit 1
fi
shell: bash # Ensure the script runs in a bash shell
- name: Set environment variables
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ZONE_ID: ${{ secrets.CLOUDFLARE_ZONE_ID }}
CLOUDFLARE_FQDN: ${{ secrets.CLOUDFLARE_FQDN }}
run: |
source venv/bin/activate
echo "Environment variables set."
shell: bash # Ensure the script runs in a bash shell
- name: Run Cloudflare script
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ZONE_ID: ${{ secrets.CLOUDFLARE_ZONE_ID }}
CLOUDFLARE_FQDN: ${{ secrets.CLOUDFLARE_FQDN }}
run: |
source venv/bin/activate
python scripts/apply_cloudflare.py --config config/cloudflare.yaml
shell: bash # Ensure the script runs in a bash shell
- name: Cleanup and feedback
if: failure()
run: echo "::error::Workflow failed at some steps. Please check the logs."