Generate-Chnroute-CI #1840
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: Generate-Chnroute-CI | |
on: | |
schedule: | |
- cron: 0 16 * * * | |
watch: | |
types: [started] | |
#push: | |
# branches: | |
# - master | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
if: github.event.repository.owner.id == github.event.sender.id || ! github.event.sender.id | |
steps: | |
- uses: actions/checkout@master | |
- name: Init build dependencies | |
env: | |
DEBIAN_FRONTEND: noninteractive | |
run: | | |
sudo -E apt-get update -y | |
sudo -E apt-get install -y aggregate | |
- name: Run generate script | |
run: | | |
chmod +x ./chnroute.sh | |
./chnroute.sh | |
rm -f ./update.txt | |
chmod +x ./mapcidr | |
./mapcidr -cl ./dist/chnroute/chnroute.txt -o ./dist/chnroute/TMP4.txt -a | |
cat ./dist/chnroute/TMP4.txt > ./dist/chnroute/chnroute.txt | |
rm -f ./dist/chnroute/TMP4.txt | |
echo `date +%Y/%m/%d\ %H:%M:%S\ %Z` >> ./update.txt | |
- name: Commit file | |
run: | | |
git config --global user.email [email protected] | |
git config --global user.name SimonsQiu | |
git add . | |
git commit -m "Update `date +%Y/%m/%d\ %H:%M:%S\ %Z`" -a | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{secrets.GITHUB_TOKEN}} | |
- name: Cleanup Workflow Logs | |
uses: Mattraks/delete-workflow-runs@main | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
repository: ${{ github.repository }} | |
retain_days: 1 |