route: enable sniff #394
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: Generate | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - 'main' | |
| paths: | |
| - 'src/**' | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| SING_BOX_VERSION: 1.13.0 | |
| SUB_STORE_VERSION: 2.21.51 | |
| jobs: | |
| generate: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install jsonnet | |
| run: | | |
| sudo apt-get update -y | |
| sudo apt-get install jsonnet | |
| jsonnet --version | |
| - name: Install sing-box | |
| run: | | |
| curl -fsSL https://sing-box.app/install.sh | sh -s -- --version "${{ env.SING_BOX_VERSION }}" | |
| sing-box version | |
| - name: Generate template config | |
| run: | | |
| for platform in android windows linux-desktop; do | |
| echo "[*] Generating template-$platform.json ..." | |
| jsonnet \ | |
| --output-file "public/template-$platform.json" \ | |
| --tla-str "platform=$platform" \ | |
| src/main.jsonnet | |
| done | |
| - name: Format template config | |
| working-directory: public | |
| run: | | |
| for config in *.json; do | |
| echo "[*] Formating template-$config ..." | |
| sing-box format -w -c "$config" | |
| done | |
| - name: Commit config | |
| uses: stefanzweifel/git-auto-commit-action@v7 | |
| with: | |
| commit_message: 'chore: update template' | |
| file_pattern: 'public/template*.json' | |
| commit_user_name: YanamiChan[bot] | |
| commit_user_email: 182213109+YanamiChan[bot]@users.noreply.github.com | |
| commit_author: YanamiChan[bot] <182213109+YanamiChan[bot]@users.noreply.github.com> | |
| build: | |
| runs-on: ubuntu-24.04 | |
| needs: generate | |
| steps: | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: "20" | |
| - name: Get sub-store | |
| run: | | |
| curl \ | |
| -LSso sub-store.js \ | |
| "https://github.com/sub-store-org/Sub-Store/releases/download/${{ env.SUB_STORE_VERSION }}/sub-store.bundle.js" | |
| - name: Get sub-store config | |
| run: | | |
| echo "${{ secrets.FILE_CONFIG }}" | base64 --decode > sub-store.json | |
| - name: Generate config | |
| run: | | |
| node sub-store.js > /dev/null 2>&1 & | |
| sleep 5 | |
| for platform in android windows linux-desktop; do | |
| echo "[*] Generating config-$platform.json ..." | |
| curl -LSso "config-$platform.json.tmp" "http://localhost:3000/api/file/$platform" | |
| jq -c . "config-$platform.json.tmp" > "config-$platform.json" | |
| done | |
| # Only node info | |
| curl -LSso mihomo.yaml "http://localhost:3000/download/1?target=ClashMeta" | |
| curl -LSso sing-box.json "http://localhost:3000/download/1?target=sing-box" | |
| curl -LSso v2ray.txt "http://localhost:3000/download/1?target=URI" | |
| - name: Upload files | |
| uses: ncipollo/release-action@v1 | |
| with: | |
| artifactErrorsFailBuild: true | |
| removeArtifacts: true | |
| allowUpdates: true | |
| generateReleaseNotes: false | |
| tag: nightly | |
| artifacts: '*.json, mihomo.yaml, v2ray.txt' | |
| prerelease: true |