Skip to content

Generate and Commit File #97

Generate and Commit File

Generate and Commit File #97

Workflow file for this run

name: Generate and Commit File
on:
workflow_dispatch:
schedule:
- cron: '0 23 * * *'
jobs:
generate-and-commit:
runs-on: ubuntu-latest
steps:
- name: Set variables
run: |
echo "update_version=$(date -d '+8 hours' +%Y-%m-%d)" >> ${GITHUB_ENV}
shell: bash
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Python3
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install sing-box
run: |
sudo curl -fsSL https://sing-box.app/gpg.key -o /etc/apt/keyrings/sagernet.asc
sudo chmod a+r /etc/apt/keyrings/sagernet.asc
echo "deb [arch=`dpkg --print-architecture` signed-by=/etc/apt/keyrings/sagernet.asc] https://deb.sagernet.org/ * *" | \
sudo tee /etc/apt/sources.list.d/sagernet.list > /dev/null
sudo apt-get update
sudo apt-get install sing-box-beta
- name: Install requirements
run: |
python3 -m pip install --upgrade pip
pip3 install -r ./requirements.txt
- name: Run
run: python3 ./convert.py
- name: generate srs files
run: |
chmod +x gen_srs.sh
./gen_srs.sh
- name: Commit and Push changes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cd ./sing-box/ || exit 1
git init
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git checkout -b output
git add . && git commit -m "sing-box-easylist 规则集文件更新于 ${update_version}"
git remote add origin "https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}"
git push -f -u origin output