Skip to content

Commit

Permalink
Comment the code of update_profile_with_api. Delete unneccessary file…
Browse files Browse the repository at this point in the history
…s. Update workflow files.
  • Loading branch information
JohanChane committed Mar 22, 2024
1 parent 79233da commit c2114a7
Show file tree
Hide file tree
Showing 18 changed files with 414 additions and 230 deletions.
94 changes: 94 additions & 0 deletions .github/workflows/build_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: Build Release

on:
push:
paths:
- 'clashtui/**'

env:
CARGO_TERM_COLOR: always

jobs:
build-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Mihomo
run: |
curl -L https://github.com/MetaCubeX/mihomo/releases/download/v1.18.1/mihomo-windows-amd64-v1.18.1.zip --output mihomo.zip
7z x mihomo.zip
mihomo-windows-amd64.exe -d Example -f Example/basic_clash_config.yaml &
- name: Cache Target
uses: actions/cache@v4
with:
path: |
./clashtui/target
~/.cargo
key: ci-${{ runner.os }}-${{ hashFiles('./clashtui/Cargo.lock') }}
restore-keys: |
ci-${{ runner.os }}-${{ hashFiles('./clashtui/Cargo.lock') }}
ci-${{ runner.os }}-
- name: Download Dependencies
run: cd clashtui && cargo fetch

- name: Run tests
run: cd clashtui && cargo test --release --all

- name: Build
run: cd clashtui && cargo build --release

- name: Build Version
run: |
cd clashtui
cargo run --release -- -v >> version.txt
- name: Pre Upload
run: |
mkdir artifacts
mv ./clashtui/target/release/clashtui.exe ./artifacts/clashtui.exe
mv ./clashtui/version.txt ./artifacts/version.txt
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: Windows_Build
path: artifacts
retention-days: 5

release:
runs-on: ubuntu-latest

needs: [build-windows]

if: startsWith(github.ref, 'refs/tags/')

permissions:
contents: write

steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
merge-multiple: true
path: ./artifacts

- name: Get version
run: |
cd ./artifacts
echo CLASHTUI_VERSION="$(cat version.txt)" >> $GITHUB_ENV
- name: Archive Release
run: |
cd ./artifacts
zip clashtui-windows-amd64-v${{ env.CLASHTUI_VERSION }}.zip -- clashtui.exe
- name: Upload Release
uses: softprops/action-gh-release@v1
with:
files: |
artifacts/clashtui-windows-amd64-v${{ env.CLASHTUI_VERSION }}.zip
46 changes: 9 additions & 37 deletions Example/profiles/profile1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,19 @@ proxy-groups:
- name: Entry
type: select
proxies:
- FilterFbAll
- name: FilterFbAll
type: fallback
- Auto-provider0
- Select-provider0
- name: Select-provider0
type: select
use:
- provider0
- provider1
filter: (?i)美|us|unitedstates|united states|日本|jp|japan|韩|kr|korea|southkorea|south korea|新|sg|singapore
- name: Auto-provider0
<<:
url: https://www.gstatic.com/generate_204
interval: 300
type: url-test
use:
- provider0
- name: Entry-RuleMode
type: select
proxies:
Expand All @@ -32,16 +35,6 @@ proxy-groups:
- Entry
- DIRECT
proxy-providers:
provider1:
<<:
interval: 3600
intehealth-check:
enable: true
url: https://www.gstatic.com/generate_204
interval: 300
type: http
url: https://www.example.com
path: proxy-providers/tpl/provider1.yaml
provider0:
<<:
interval: 3600
Expand All @@ -50,7 +43,7 @@ proxy-providers:
url: https://www.gstatic.com/generate_204
interval: 300
type: http
url: https://www.example.com
url: https://cdn.jsdelivr.net/gh/anaer/Sub@main/clash.yaml
path: proxy-providers/tpl/provider0.yaml
rule-anchor:
ip:
Expand All @@ -74,27 +67,6 @@ rule-providers:
format: yaml
rules:
- RULE-SET,private,DIRECT
- DOMAIN-SUFFIX,cn.bing.com,DIRECT
- DOMAIN-SUFFIX,bing.com,Entry
- DOMAIN,aur.archlinux.org,Entry
- GEOIP,lan,DIRECT,no-resolve
- GEOSITE,biliintl,Entry
- GEOSITE,ehentai,Entry
- GEOSITE,github,Entry
- GEOSITE,twitter,Entry
- GEOSITE,youtube,Entry
- GEOSITE,google,Entry
- GEOSITE,telegram,Entry
- GEOSITE,netflix,Entry
- GEOSITE,bilibili,Entry-RuleMode
- GEOSITE,bahamut,Entry
- GEOSITE,spotify,Entry
- GEOSITE,geolocation-!cn,Entry
- GEOIP,google,Entry
- GEOIP,netflix,Entry
- GEOIP,telegram,Entry
- GEOIP,twitter,Entry
- GEOSITE,pixiv,Entry
- GEOSITE,CN,Entry-RuleMode
- GEOIP,CN,Entry-RuleMode
- MATCH,Entry-LastMatch
9 changes: 5 additions & 4 deletions Example/templates/generic_tpl.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
pp: &pp {interval: 3600, intehealth-check: {enable: true, url: https://www.gstatic.com/generate_204, interval: 300}}
delay_test: &delay_test {url: https://www.gstatic.com/generate_204, interval: 300}
proxy-anchor:
- delay_test: &pa_dt {url: https://www.gstatic.com/generate_204, interval: 300}
- proxy_provider: &pa_pp {interval: 3600, intehealth-check: {enable: true, url: https://www.gstatic.com/generate_204, interval: 300}}

proxy-groups:
- name: "Entry"
Expand All @@ -17,7 +18,7 @@ proxy-groups:
tpl_param:
providers: ["provider"]
type: url-test
<<: *delay_test
<<: *pa_dt

- name: "Entry-RuleMode"
type: select
Expand All @@ -35,7 +36,7 @@ proxy-providers:
provider:
tpl_param:
type: http # type 字段要放在此处, 不能放入 pp。原因是要用于更新资源。
<<: *pp
<<: *pa_pp

rules:
- GEOIP,lan,DIRECT,no-resolve
Expand Down
12 changes: 7 additions & 5 deletions Example/templates/generic_tpl_with_all.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
pp: &pp {interval: 3600, intehealth-check: {enable: true, url: https://www.gstatic.com/generate_204, interval: 300}}
delay_test: &delay_test {url: https://www.gstatic.com/generate_204, interval: 300}
proxy-anchor:
- delay_test: &pa_dt {url: https://www.gstatic.com/generate_204, interval: 300}
- proxy_provider: &pa_pp {interval: 3600, intehealth-check: {enable: true, url: https://www.gstatic.com/generate_204, interval: 300}}


proxy-groups:
- name: "Entry"
Expand All @@ -24,13 +26,13 @@ proxy-groups:
type: url-test
proxies:
- <Auto>
<<: *delay_test
<<: *pa_dt

- name: "Auto"
tpl_param:
providers: ["provider"]
type: url-test
<<: *delay_test
<<: *pa_dt

- name: "Entry-RuleMode"
type: select
Expand All @@ -48,7 +50,7 @@ proxy-providers:
provider:
tpl_param:
type: http
<<: *pp
<<: *pa_pp

rules:
- GEOIP,lan,DIRECT,no-resolve
Expand Down
9 changes: 5 additions & 4 deletions Example/templates/generic_tpl_with_filter.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
pp: &pp {interval: 3600, intehealth-check: {enable: true, url: https://www.gstatic.com/generate_204, interval: 300}}
delay_test: &delay_test {url: https://www.gstatic.com/generate_204, interval: 300}
proxy-anchor:
- delay_test: &pa_dt {url: https://www.gstatic.com/generate_204, interval: 300}
- proxy_provider: &pa_pp {interval: 3600, intehealth-check: {enable: true, url: https://www.gstatic.com/generate_204, interval: 300}}

proxy-groups:
- name: "Entry"
Expand Down Expand Up @@ -31,7 +32,7 @@ proxy-groups:
tpl_param:
providers: ["provider"]
type: url-test
<<: *delay_test
<<: *pa_dt

- name: "Entry-RuleMode"
type: select
Expand All @@ -49,7 +50,7 @@ proxy-providers:
provider: # `provider` name is customizable. Generate proxy-providers which name is `provider`: provider0, provider1, ...
tpl_param:
type: http
<<: *pp
<<: *pa_pp

rules:
#- IN-TYPE,INNER,DIRECT # set inner type connection. e.g. update proxy-providers, rule-providers etc.
Expand Down
Loading

0 comments on commit c2114a7

Please sign in to comment.