ClashMeta + Amnezia #480
This file contains hidden or 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: ClashMeta + Amnezia | |
| on: | |
| push: | |
| branches: ['main'] | |
| paths: | |
| - '**/winterguard.*' | |
| - 'sub/*.yml' | |
| - 'edge/assets/*.yml' | |
| schedule: | |
| - cron: '0 */6 * * *' | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 10 | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| submodules: 'recursive' | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: List directory contents | |
| run: | | |
| ls -R edge | |
| cat edge/requirements.txt | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| cache: pip | |
| architecture: x64 | |
| # Creating a cache for increased speed and performance, also saving resources | |
| - name: Cache Python packages | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/pip | |
| key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pip- | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip || exit 1 | |
| pip install -r edge/requirements.txt || exit 1 | |
| # Run ;) | |
| - name: Run config generation script | |
| run: | | |
| python edge/winterguard.py 2>&1 || { echo "Script failed with exit code $?"; exit 1; } | |
| - name: Commit and push config files | |
| run: | | |
| git config --local user.name "Github Actions" | |
| git config --local user.email "actions@github.com" | |
| if git status --porcelain | grep -q "sub/clash-meta-wg.yml" || git status --porcelain; then | |
| echo "Changes detected. Committing and pushing." | |
| git add sub/clash-meta-wg.yml | |
| git commit -m "Auto: Update clash-wg configurations at: $(TZ='Asia/Tehran' date '+%H:%M:%S')" -m "Wireguard private key, addresses, reserved, and all IPs have been renewed" | |
| git -c committer.name="NiREvil" -c committer.email="126243832+NiREvil@users.noreply.github.com" push | |
| else | |
| echo "No changes detected in config files." | |
| fi | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |