Skip to content

Commit dc500d1

Browse files
feat: upgrade workflow
This commit cleans up the shell script, updates LICENSE and README, and adds a gitignore. BREAKING CHANGE: this commit removes the intermediate Docker action
1 parent e9a3666 commit dc500d1

File tree

8 files changed

+191
-115
lines changed

8 files changed

+191
-115
lines changed

.github/actions/docker/action.yml

-8
This file was deleted.

.github/workflows/workflow.yml

+34-63
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,44 @@
1-
name: blocklist.p2p
1+
name: Generate blocklist
22

33
on:
44
schedule:
55
- cron: '0 0 * * *'
66

7+
defaults:
8+
run:
9+
shell: bash
10+
711
jobs:
812
build:
9-
name: Generate IP blocklist
1013
runs-on: ubuntu-latest
1114

1215
steps:
13-
- name: Checkout the main branch
14-
uses: actions/checkout@v3
15-
16-
- name: Run the script
17-
uses: ./.github/actions/docker
18-
19-
- name: Get current date
20-
id: date
21-
run: echo "today=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
22-
23-
- name: Import GPG key
24-
uses: crazy-max/ghaction-import-gpg@v5
25-
with:
26-
git_committer_name: "Roberto Schiavone"
27-
git_committer_email: "[email protected]"
28-
git_user_signingkey: true
29-
git_commit_gpgsign: true
30-
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
31-
passphrase: ${{ secrets.PASSPHRASE }}
32-
33-
- name: Commit, push, tag
34-
run: |
35-
git checkout --orphan release
36-
git rm --cached $(git ls-files)
37-
git add blocklist.p2p
38-
git commit -S -m "chore: ${{ steps.date.outputs.today }} build :bookmark:"
39-
git push -f origin release
40-
git tag "${{ steps.date.outputs.today }}"
41-
git tag latest
42-
git push -f origin "${{ steps.date.outputs.today }}"
43-
git push -f origin latest
44-
45-
- name: Checkout the release branch
46-
uses: actions/checkout@v3
47-
with:
48-
ref: "release"
49-
50-
- name: Upload binaries to release
51-
uses: svenstaro/upload-release-action@v2
52-
with:
53-
repo_token: ${{ secrets.GITHUB_TOKEN }}
54-
file: blocklist.p2p
55-
asset_name: blocklist.p2p
56-
tag: "${{ steps.date.outputs.today }}"
57-
overwrite: true
58-
59-
- name: Upload binaries to release
60-
uses: svenstaro/upload-release-action@v2
61-
with:
62-
repo_token: ${{ secrets.GITHUB_TOKEN }}
63-
file: blocklist.p2p
64-
asset_name: blocklist.p2p
65-
tag: latest
66-
overwrite: true
67-
68-
- name: Cleanup
69-
run: |
70-
git checkout -f main
71-
git branch -D release
72-
git push origin :release
73-
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
19+
- name: Run script
20+
run: |
21+
chmod +x ./blocklist.sh
22+
./blocklist.sh
23+
24+
- name: Tag branch
25+
run: |
26+
gh release delete latest --yes || true
27+
git tag -f latest
28+
git push -f origin latest
29+
env:
30+
GH_TOKEN: ${{ github.token }}
31+
32+
- name: Set release date
33+
run: |
34+
echo "RELEASE_DATE=$(date --rfc-3339=date)" >> ${GITHUB_ENV}
35+
36+
- name: Release
37+
uses: softprops/action-gh-release@v2
38+
with:
39+
body: |
40+
Automated nightly build
41+
42+
Generated on: ${{ env.RELEASE_DATE }}
43+
tag_name: latest
44+
files: blocklist.p2p

.gitignore

+126
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
# Created by https://www.toptal.com/developers/gitignore/api/git,jetbrains+all,visualstudiocode
2+
# Edit at https://www.toptal.com/developers/gitignore?templates=git,jetbrains+all,visualstudiocode
3+
4+
### Git ###
5+
# Created by git for backups. To disable backups in Git:
6+
# $ git config --global mergetool.keepBackup false
7+
*.orig
8+
9+
# Created by git when using merge tools for conflicts
10+
*.BACKUP.*
11+
*.BASE.*
12+
*.LOCAL.*
13+
*.REMOTE.*
14+
*_BACKUP_*.txt
15+
*_BASE_*.txt
16+
*_LOCAL_*.txt
17+
*_REMOTE_*.txt
18+
19+
### JetBrains+all ###
20+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
21+
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
22+
23+
# User-specific stuff
24+
.idea/**/workspace.xml
25+
.idea/**/tasks.xml
26+
.idea/**/usage.statistics.xml
27+
.idea/**/dictionaries
28+
.idea/**/shelf
29+
30+
# AWS User-specific
31+
.idea/**/aws.xml
32+
33+
# Generated files
34+
.idea/**/contentModel.xml
35+
36+
# Sensitive or high-churn files
37+
.idea/**/dataSources/
38+
.idea/**/dataSources.ids
39+
.idea/**/dataSources.local.xml
40+
.idea/**/sqlDataSources.xml
41+
.idea/**/dynamic.xml
42+
.idea/**/uiDesigner.xml
43+
.idea/**/dbnavigator.xml
44+
45+
# Gradle
46+
.idea/**/gradle.xml
47+
.idea/**/libraries
48+
49+
# Gradle and Maven with auto-import
50+
# When using Gradle or Maven with auto-import, you should exclude module files,
51+
# since they will be recreated, and may cause churn. Uncomment if using
52+
# auto-import.
53+
# .idea/artifacts
54+
# .idea/compiler.xml
55+
# .idea/jarRepositories.xml
56+
# .idea/modules.xml
57+
# .idea/*.iml
58+
# .idea/modules
59+
# *.iml
60+
# *.ipr
61+
62+
# CMake
63+
cmake-build-*/
64+
65+
# Mongo Explorer plugin
66+
.idea/**/mongoSettings.xml
67+
68+
# File-based project format
69+
*.iws
70+
71+
# IntelliJ
72+
out/
73+
74+
# mpeltonen/sbt-idea plugin
75+
.idea_modules/
76+
77+
# JIRA plugin
78+
atlassian-ide-plugin.xml
79+
80+
# Cursive Clojure plugin
81+
.idea/replstate.xml
82+
83+
# SonarLint plugin
84+
.idea/sonarlint/
85+
86+
# Crashlytics plugin (for Android Studio and IntelliJ)
87+
com_crashlytics_export_strings.xml
88+
crashlytics.properties
89+
crashlytics-build.properties
90+
fabric.properties
91+
92+
# Editor-based Rest Client
93+
.idea/httpRequests
94+
95+
# Android studio 3.1+ serialized cache file
96+
.idea/caches/build_file_checksums.ser
97+
98+
### JetBrains+all Patch ###
99+
# Ignore everything but code style settings and run configurations
100+
# that are supposed to be shared within teams.
101+
102+
.idea/*
103+
104+
!.idea/codeStyles
105+
!.idea/runConfigurations
106+
107+
### VisualStudioCode ###
108+
.vscode/*
109+
!.vscode/settings.json
110+
!.vscode/tasks.json
111+
!.vscode/launch.json
112+
!.vscode/extensions.json
113+
!.vscode/*.code-snippets
114+
115+
# Local History for Visual Studio Code
116+
.history/
117+
118+
# Built Visual Studio Code Extensions
119+
*.vsix
120+
121+
### VisualStudioCode Patch ###
122+
# Ignore all local history of files
123+
.history
124+
.ionide
125+
126+
# End of https://www.toptal.com/developers/gitignore/api/git,jetbrains+all,visualstudiocode

Dockerfile

-20
This file was deleted.

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2023 Roberto Schiavone
3+
Copyright (c) 2025 Roberto Schiavone
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22

33
[![blocklist.p2p](https://github.com/robertoschiavone/blocklist/actions/workflows/workflow.yml/badge.svg)](https://github.com/robertoschiavone/blocklist/actions/workflows/workflow.yml)
44

5-
This repository contains only one GitHub Action that pulls and merges together lists from [I-Blocklist](https://www.iblocklist.com/). The list excludes IANA reserved addresses, unallocated addresses and Tor IPs, and it's refreshed daily.
5+
This repository contains only one GitHub Action that pulls and merges together lists
6+
from [I-Blocklist](https://www.iblocklist.com/). The list excludes IANA reserved addresses, unallocated addresses and
7+
Tor IPs, and it's refreshed daily.
68

7-
The generated file is in [P2P plaintext format](https://en.wikipedia.org/wiki/PeerGuardian#P2P_plaintext_format) and the latest version can always be found [here](https://github.com/robertoschiavone/blocklist/releases/download/latest/blocklist.p2p).
9+
The generated file is in [P2P plaintext format](https://en.wikipedia.org/wiki/PeerGuardian#P2P_plaintext_format) and the
10+
latest version can always be found [here](https://github.com/robertoschiavone/blocklist/releases/download/latest/blocklist.p2p).
811

912
![transmission screenshot](transmission.png)
1013

1114
Inspired by the previous work of [@johntyree](https://gist.github.com/johntyree/3331662)
12-

blocklist.sh

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash -l
2+
3+
# Unofficial Bash Strict Mode
4+
set -euo pipefail
5+
IFS=$'\n\t'
6+
7+
FILE=blocklist.p2p
8+
TEMP_FILE="${FILE}.tmp"
9+
10+
# Cleanup
11+
trap 'rm -f ${TEMP_FILE}' EXIT
12+
13+
curl -s --fail https://www.iblocklist.com/lists.json \
14+
| jq -r '.lists[] | .name as $n | select((.subscription == "false") and
15+
($n | startswith("iana-") | not) and (["fornonlancomputers", "bogon",
16+
"The Onion Router"] | index($n) | not)) | .list' \
17+
| awk 'length($0) > 2 {
18+
print "https://list.iblocklist.com/?fileformat=p2p&archiveformat=gz&list=" $0
19+
}' \
20+
| xargs wget --quiet -O - \
21+
| gunzip \
22+
| grep -Ev '^#' > "${FILE}"
23+
24+
# Remove first line and ensure trailing newline
25+
tail -n +2 "${FILE}" > "${TEMP_FILE}" && mv "${TEMP_FILE}" "${FILE}"

entrypoint.sh

-20
This file was deleted.

0 commit comments

Comments
 (0)