Force push artifacts to release branch to avoid .git foler takes up too much space as commits increase.
This commit is contained in:
parent
10181e235d
commit
9a009a8188
|
@ -45,39 +45,42 @@ jobs:
|
|||
- name: Merge and IP lists and remove duplicates
|
||||
run: |
|
||||
awk 'FNR==1{print ""}{print}' dist/*.txt > dist/merge.txt
|
||||
awk '!seen[$0]++' dist/merge.txt > dist/geoip-cn.txt
|
||||
awk '!seen[$0]++' dist/merge.txt > dist/CN-ip-cidr.txt
|
||||
|
||||
- name: Generate GeoIP2 database
|
||||
run: |
|
||||
CURRENT_DIR=$(pwd)
|
||||
cd dist
|
||||
./ipip2mmdb -s ./geoip-cn.txt -d Country.mmdb
|
||||
./ipip2mmdb -s ./CN-ip-cidr.txt -d Country.mmdb
|
||||
cd $CURRENT_DIR
|
||||
|
||||
- name: Save artifacts
|
||||
- name: Push artifacts to release branch
|
||||
run: |
|
||||
if [ ! -d artifacts ]; then
|
||||
mkdir -p artifacts
|
||||
fi
|
||||
|
||||
cp -rf dist/geoip-cn.txt artifacts/
|
||||
cp -rf dist/Country.mmdb artifacts/
|
||||
|
||||
- name: Commit Changes
|
||||
run: |
|
||||
if [ -z "$(git status --porcelain)" ]; then
|
||||
exit 0
|
||||
else
|
||||
git add artifacts
|
||||
git config --local user.email "10215166+Hackl0us@users.noreply.github.com"
|
||||
git config --local user.name "github-action[bot]"
|
||||
git commit -m "Update GeoIP at $(date)" -a
|
||||
fi
|
||||
|
||||
git fetch
|
||||
git checkout release
|
||||
|
||||
git checkout --orphan release-orphan
|
||||
git rm -rf .
|
||||
|
||||
cp -rf dist/CN-ip-cidr.txt ./
|
||||
cp -rf dist/Country.mmdb ./
|
||||
|
||||
git add Country.mmdb
|
||||
git add CN-ip-cidr.txt
|
||||
git commit -am "Updated at $(date)"
|
||||
|
||||
git branch -D release
|
||||
git branch -m release
|
||||
|
||||
- name: GitHub Push
|
||||
uses: ad-m/github-push-action@v0.5.0
|
||||
uses: ad-m/github-push-action@v0.6.0
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
branch: release
|
||||
force: true
|
||||
|
||||
- name: Purge CDN Cache
|
||||
run: curl ${{ secrets.CDN_URL }}
|
|
@ -26,10 +26,10 @@ GeoIP2 数据库的大小仅为 111 KB,对比原来庞大的 4 MB 数据库,
|
|||
项目每隔 3 天通过全自动化部署自我更新,时刻保持最佳体验。
|
||||
|
||||
### 📥 下载链接
|
||||
| 📦 项目 | 📃 文件 | 🐙 GitHub RAW | 🚀 CDN 加速 |
|
||||
| :--: | :--: | :--: | :--: |
|
||||
| IP-CIDR 列表 | geoip-cn.txt | [点我下载](https://github.com/Hackl0us/GeoIP-CN/raw/master/artifacts/geoip-cn.txt) | [点我起飞](https://cdn.jsdelivr.net/gh/Hackl0us/GeoIP-CN@master/artifacts/geoip-cn.txt) |
|
||||
| GeoIP2 数据库 | Country.mmdb | [点我下载](https://github.com/Hackl0us/GeoIP-CN/raw/master/artifacts/Country.mmdb) | [点我起飞](https://cdn.jsdelivr.net/gh/Hackl0us/GeoIP-CN@master/artifacts/Country.mmdb) |
|
||||
| 📦 项目 | 📃 文件 | 🐙 GitHub RAW | 🚀 CDN 加速 | 🔧 适用范围
|
||||
| :--: | :--: | :--: | :--: | ---- |
|
||||
| IP-CIDR 列表 | CN-ip-cidr.txt | [点我下载](https://github.com/Hackl0us/GeoIP2-CN/raw/release/CN-ip-cidr.txt) | [点我起飞](https://cdn.jsdelivr.net/gh/Hackl0us/GeoIP2-CN@release/CN-ip-cidr.txt) | 防火墙、较老的代理工具等 |
|
||||
| GeoIP2 数据库 | Country.mmdb | [点我下载](https://github.com/Hackl0us/GeoIP2-CN/raw/release/Country.mmdb) | [点我起飞](https://cdn.jsdelivr.net/gh/Hackl0us/GeoIP2-CN@release/Country.mmdb) | Surge, Shadowrocket,<br>QuantumultX, Clash<br>等较新的代理工具|
|
||||
|
||||
对于网络状况良好、无污染的环境下,建议选择 GitHub RAW 的方式下载,因为可以第一获取到最新的资源,因为服务器在境外,可能下载响应时间和速度稍长,但因为文件小,所以通常问题不大。
|
||||
|
||||
|
|
Loading…
Reference in New Issue