Update China IP #17
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update China IP list and generate BypassCN.rule | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 2 */3 * *' | |
jobs: | |
build: | |
name: Generate BypassCN.rule | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code into directory | |
uses: actions/checkout@v3 | |
- name: Run the updategeoip-cn.sh | |
run: ./tools/updategeoip-cn.sh | |
shell: bash | |
- name: Git Add BypassCNandLan.rules | |
run: | | |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git config user.name "github-actions[bot]" | |
git fetch | |
cp ./BypassCNandLan.rules ./rules/BypassCNandLan.rules | |
git add ./rules/BypassCNandLan.rules | |
if ! git commit -am "Updated at $(date)"; then | |
curl -oL ./ https://github.com/FQrabbit/SSTap-Rule/raw/master/rules/BypassCNandLan.rules | |
hash1=$(sha256sum "./BypassCNandLan.rules" | awk '{print $1}') | |
hash2=$(sha256sum "./rules/BypassCNandLan.rules" | awk '{print $1}') | |
if [ "$hash1" == "$hash2" ]; then | |
echo "Hashes match. The files are identical." | |
echo "Upstream not updated" | |
else | |
echo "Hashes do not match. The files are different." | |
echo "ERROR! Upstream updated! There's something went WRONG!" | |
exit 1 | |
fi | |
fi | |
- name: GitHub Push | |
uses: ad-m/github-push-action@v0.6.0 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: master | |
force: true |