forked from alvincrisuy/clashX
-
Notifications
You must be signed in to change notification settings - Fork 417
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
167 additions
and
60 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,8 +25,8 @@ jobs: | |
uses: robinraju/[email protected] | ||
with: | ||
repository: 'MetaCubeX/Clash.Meta' | ||
tag: "v1.14.0" | ||
fileName: ".*darwin.*.gz" | ||
tag: "v1.14.2" | ||
fileName: ".*darwin.*64-v.*.gz" | ||
out-file-path: "clash.meta" | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
|
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import subprocess | ||
import datetime | ||
import plistlib | ||
import os | ||
|
||
def get_version(): | ||
with open('./go.mod') as file: | ||
for line in file.readlines(): | ||
if "clash" in line and "ClashX" not in line: | ||
return line.split("-")[-1].strip()[:6] | ||
return "unknown" | ||
|
||
def get_full_version(): | ||
with open('./go.mod') as file: | ||
for line in file.readlines(): | ||
if "clash" in line and "ClashX" not in line: | ||
return line.split(" ")[-1].strip() | ||
|
||
def build_clash(version): | ||
build_time = datetime.datetime.now().strftime("%Y-%m-%d-%H%M") | ||
command = f"""CGO_CFLAGS=-mmacosx-version-min=10.12 \ | ||
CGO_LDFLAGS=-mmacosx-version-min=10.12 \ | ||
go build -trimpath -ldflags '-X "github.com/Dreamacro/clash/constant.Version={version}" \ | ||
-X "github.com/Dreamacro/clash/constant.BuildTime={build_time}"' \ | ||
-buildmode=c-archive -o goClash.a """ | ||
subprocess.check_output(command, shell=True) | ||
|
||
|
||
def write_to_info(version): | ||
path = "../info.plist" | ||
|
||
with open(path, 'rb') as f: | ||
contents = plistlib.load(f) | ||
|
||
if not contents: | ||
exit(-1) | ||
|
||
contents["coreVersion"] = version | ||
with open(path, 'wb') as f: | ||
plistlib.dump(contents, f, sort_keys=False) | ||
|
||
|
||
def run(): | ||
version = get_version() | ||
print("current clash version:", version) | ||
build_clash(version) | ||
print("build static library complete!") | ||
if os.environ.get("CI", False) or os.environ.get("GITHUB_ACTIONS", False): | ||
print("writing info.plist") | ||
write_to_info(version) | ||
print("done") | ||
|
||
|
||
if __name__ == "__main__": | ||
run() |
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.