-
Notifications
You must be signed in to change notification settings - Fork 5
77 lines (66 loc) · 2.22 KB
/
test-new-gen.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
name: Test new gen
on:
schedule:
- cron: '0 * * * *'
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
jobs:
Generate-Blacklist:
runs-on: ubuntu-latest
steps:
- name: Setup Git Configurations
run: |
git config --global user.email "[email protected]"
git config --global user.name "github-actions[bot]"
- name: Check out repository code
uses: actions/checkout@v4
with:
fetch-depth: 1 # Fetch all history for completeness
ref: main
token: ${{ secrets.PAT }}
- name: Generate blacklist
run: sudo /bin/bash generate_fqdn_v2.sh # output: all.fqdn.blacklist
- name: Extract current blacklist.txt
run: |
mkdir current
mv all.fqdn.blacklist current/all.fqdn.blacklist
mv current/all.fqdn.blacklist current/blacklist.txt
- name: Count domains in blacklist
id: count_domains
run: |
count=$(wc -l < current/blacklist.txt)
echo "Number of domains: $count"
echo "::set-output name=count::$count"
- name: Delete Release if Exists
run: |
release_id=$(curl -H "Authorization: token ${{ secrets.PAT }}" -s "https://api.github.com/repos/$GITHUB_REPOSITORY/releases/tags/latest" | jq .id)
if [ "$release_id" != "null" ]; then
curl -X DELETE -H "Authorization: token ${{ secrets.PAT }}" "https://api.github.com/repos/$GITHUB_REPOSITORY/releases/$release_id"
fi
- name: Create Release
id: create_release
uses: actions/create-release@v1
with:
tag_name: latest
release_name: "Domains Blacklist"
body: "Domains: ${{ steps.count_domains.outputs.count }}"
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
- name: Upload Release Asset (Blacklist)
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./current/blacklist.txt
asset_name: blacklist.txt
asset_content_type: text/plain
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
- name: Clean up
run: rm -r current
env:
GITHUB_TOKEN: ${{ secrets.PAT }}