Daily Run #11
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: Daily Run | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| schedule: | |
| - cron: '0 2 * * *' # Runs at 2 AM every day | |
| jobs: | |
| daily-run: | |
| runs-on: ubuntu-latest | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| GO_VERSION: '1.24' | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: ${{ env.GO_VERSION }} | |
| - name: Cache Go modules | |
| uses: actions/cache@v3 | |
| with: | |
| path: | | |
| ~/.cache/go-build | |
| /go/pkg/mod | |
| key: ${{ runner.os }}-go-${{ env.GO_VERSION }}-${{ hashFiles('**/go.sum') }} | |
| restore-keys: | | |
| ${{ runner.os }}-go-${{ env.GO_VERSION }}- | |
| - name: Initialize Go module | |
| run: | | |
| if [ ! -f go.mod ]; then | |
| go mod init cf-tools | |
| go mod tidy | |
| fi | |
| - name: Commit go.mod & go.sum | |
| if: ${{ success() }} | |
| run: | | |
| git config --global user.name 'github-actions[bot]' | |
| git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
| TIMESTAMP=$(date -u +"%H:%M %d-%m-%Y") | |
| git add go.mod go.sum | |
| if git diff --cached --quiet; then | |
| echo "No changes to commit" | |
| else | |
| git commit -m "Update dependencies - $TIMESTAMP" | |
| git push | |
| fi | |
| - name: Wait for 2 seconds | |
| run: sleep 2 | |
| - name: Add dependencies | |
| if: ${{ success() }} | |
| run: | | |
| go get github.com/flynn/noise | |
| go get golang.org/x/crypto/blake2s | |
| go get golang.org/x/crypto/curve25519 | |
| - name: Wait for 2 seconds | |
| run: sleep 2 | |
| - name: Build the application | |
| if: ${{ success() }} | |
| run: go build -o cf-tools main.go | |
| - name: Wait for 2 seconds | |
| run: sleep 2 | |
| - name: Run Fetch and Convert | |
| if: ${{ success() }} | |
| run: ./cf-tools -f | |
| - name: Commit output from ./cf-tools -f | |
| uses: stefanzweifel/git-auto-commit-action@v6 | |
| with: | |
| commit_message: "Update all_cf_v4_24.txt - $TIMESTAMP" | |
| file_pattern: all_cf_v4_24.txt | |
| - name: Wait for 5 seconds | |
| run: sleep 5 | |
| - name: Run CDN Checker | |
| if: ${{ success() }} | |
| run: ./cf-tools -c | |
| - name: Commit output from ./cf-tools -c | |
| uses: stefanzweifel/git-auto-commit-action@v6 | |
| with: | |
| commit_message: "Update all_cdn_ipv4.txt - $TIMESTAMP" | |
| file_pattern: all_cdn_ipv4.txt | |
| - name: Wait for 5 seconds | |
| run: sleep 5 | |
| - name: Run WARP Checker | |
| if: ${{ success() }} | |
| run: ./cf-tools -w | |
| - name: Commit output from ./cf-tools -w | |
| uses: stefanzweifel/git-auto-commit-action@v6 | |
| with: | |
| commit_message: "Update all_warp_ipv4.txt - $TIMESTAMP" | |
| file_pattern: all_warp_ipv4.txt |