-
-
Notifications
You must be signed in to change notification settings - Fork 1
145 lines (117 loc) · 4.72 KB
/
blocklist-generate.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# #
# @usage https://github.com/Aetherinox/csf-firewall
# @type github workflow
#
# used in combination with .github/scripts/bl-download.sh
#
# download AbuseIPDB ip list after list of ips are downloaded, merges them with a static list
# that is not updated as often which contains a list of long-term abusive ip addresses
#
# local test requires the same structure as the github workflow
# 📁 .github
# 📁 blocks
# 📄 1.txt
# 📁 scripts
# 📄 bl-download.sh
# 📁 workflows
# 📄 blocklist-generate.yml
# #
name: "🧱 Blocklist › Generate"
run-name: "🧱 Blocklist › Generate"
# #
# triggers
# #
on:
workflow_dispatch:
schedule:
- cron: '0 */6 * * *'
# #
# environment variables
# #
env:
BOT_NAME_1: EuropaServ
BOT_NAME_DEPENDABOT: dependabot[bot]
# #
# jobs
# #
jobs:
build:
runs-on: ubuntu-22.04
timeout-minutes: 3
steps:
# #
# Job > Start
# #
- name: "✅ Start"
id: task_build_start
run: |
echo "Starting blocklist build script"
# #
# Job > Checkout
# #
- name: "☑️ Checkout"
id: task_build_checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
# #
# Generate > Master
# #
- name: "🧱 Generate › Master"
id: task_build_generate_master
run: |
# #
# set permissions and run generator
# #
chmod +x ".github/scripts/bl-download.sh"
run_master=".github/scripts/bl-download.sh ${{ vars.API_01_OUT }} false ${{ secrets.API_01_FILE_01 }} ${{ secrets.API_01_FILE_02 }} ${{ secrets.API_01_FILE_03 }}"
eval "./$run_master"
# #
# Generate > Privacy
# #
- name: "🧱 Generate › Privacy"
id: task_build_generate_privacy
run: |
# #
# set permissions and run generator
# #
chmod +x ".github/scripts/bl-static.sh"
run_general=".github/scripts/bl-static.sh ${{ vars.API_02_GENERAL_OUT }} privacy"
eval "./$run_general"
chmod +x ".github/scripts/bl-json.sh"
run_google=".github/scripts/bl-json.sh ${{ vars.API_02_GOOGLE_OUT }} ${{secrets.API_02_GOOGLE_URL}} '.prefixes | .[] |.ipv4Prefix//empty,.ipv6Prefix//empty'"
eval "./$run_google"
chmod +x ".github/scripts/bl-json.sh"
run_cloudfront=".github/scripts/bl-json.sh ${{ vars.API_02_CLOUDFRONT_OUT }} ${{ secrets.API_02_CLOUDFRONT_URL }} 'map(.[]) | sort | .[]'"
eval "./$run_cloudfront"
chmod +x ".github/scripts/bl-json.sh"
run_bing=".github/scripts/bl-json.sh ${{ vars.API_02_BING_OUT }} ${{ secrets.API_02_BING_URL }} '.prefixes | .[] |.ipv4Prefix//empty,.ipv6Prefix//empty'"
eval "./$run_bing"
chmod +x ".github/scripts/bl-json.sh"
run_fastly=".github/scripts/bl-json.sh ${{ vars.API_02_FASTLY_OUT }} ${{ secrets.API_02_FASTLY_URL }} 'map(.[]) | .[]'"
eval "./$run_fastly"
chmod +x ".github/scripts/bl-json.sh"
run_amz_aws=".github/scripts/bl-json.sh ${{ vars.API_02_AMAZON_AWS_OUT }} ${{ secrets.API_02_AMAZON_URL }} '.prefixes[] | select(.service==\"AMAZON\") | .ip_prefix'"
eval "./$run_amz_aws"
chmod +x ".github/scripts/bl-json.sh"
run_amz_ec2=".github/scripts/bl-json.sh ${{ vars.API_02_AMAZON_EC2_OUT }} ${{ secrets.API_02_AMAZON_URL }} '.prefixes[] | select(.service==\"EC2\") | .ip_prefix'"
eval "./$run_amz_ec2"
# #
# Generate > Precommit
# #
- name: "📦 Pre-commit"
id: task_build_precommit
run: |
now=$(date '+%m/%d/%Y %H:%M')
commit_label="Sync" >> $GITHUB_ENV
commit_message="\`️️⚡️ $commit_label ⚡️\` \`$now\`" >> $GITHUB_ENV
echo "COMMIT_MESSAGE=$(echo $commit_message)" >> $GITHUB_ENV
echo "NOW=$(echo $now)" >> $GITHUB_ENV
# #
# Generate > Commit
# #
- name: "📦 Commit"
id: task_build_commit
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: ${{ env.COMMIT_MESSAGE }}