forked from alvincrisuy/clashX
-
Notifications
You must be signed in to change notification settings - Fork 394
118 lines (102 loc) · 4.39 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
name: ClashX
on: [ push, workflow_dispatch ]
env:
FASTLANE_SKIP_UPDATE_CHECK: true
jobs:
build:
runs-on: macos-13
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: import certs
run: |
echo `/usr/bin/xcodebuild -version`
openssl aes-256-cbc -k "${{ secrets.ENCRYPTION_SECRET }}" -in ".github/certs/dist.p12.enc" -d -a -out ".github/certs/dist.p12" -md md5
- name: setup Go
uses: actions/setup-go@v3
with:
go-version: 1.21.x
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- name: install deps
run: |
bash install_dependency.sh
- name: update dev build version
if: ${{!startsWith(github.ref, 'refs/tags/')}}
run: |
tag=`git describe --abbrev=0`.`date '+%m%d%H%M%S'`
bundle exec fastlane run increment_build_number_in_plist build_number:"${tag}" scheme:"ClashX"
bundle exec fastlane run increment_version_number_in_plist version_number:"${tag}" scheme:"ClashX"
bundle exec fastlane run set_info_plist_value path:ClashX/Info.plist key:BETA value:true
- name: update tag build version
if: startsWith(github.ref, 'refs/tags/')
run: |
tag=${GITHUB_REF##*/}
bundle exec fastlane run set_info_plist_value path:ClashX/Info.plist key:BETA value:false
bundle exec fastlane run increment_build_number_in_plist build_number:"${tag}" scheme:"ClashX"
bundle exec fastlane run increment_version_number_in_plist version_number:"${tag}" scheme:"ClashX"
- name: build
env:
CODE_SIGN_IDENTITY: "Developer ID Application: Fuzhou West2Online Internet Inc. (MEWHFZ92DY)"
run: |
cd ClashX
python3 add_build_info.py
cd ..
bundle exec fastlane build
echo "Checking SMJobBless Vailded"
python3 SMJobBlessUtil.py check ClashX.app
echo "Check done"
- name: setup node
if: startsWith(github.ref, 'refs/tags/') || contains(github.event.head_commit.message, '[beta]')
uses: actions/setup-node@v3
with:
node-version: '18.x'
- name: create dmg
if: startsWith(github.ref, 'refs/tags/') || contains(github.event.head_commit.message, '[beta]')
run: |
npm install --global create-dmg
create-dmg ClashX.app
mv ClashX*.dmg ClashX.dmg
- name: notarize
if: startsWith(github.ref, 'refs/tags/') || contains(github.event.head_commit.message, '[beta]')
env:
FASTLANE_PASSWORD: ${{ secrets.FASTLANE_PASSWORD }}
FASTLANE_USER: ${{ secrets.FASTLANE_USER }}
FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD: ${{ secrets.FASTLANE_PASSWORD }}
run: |
bundle exec fastlane run notarize package:"./ClashX.dmg" bundle_id:"com.west2online.ClashX" asc_provider:MEWHFZ92DY
- name: upload to appcenter
if: startsWith(github.ref, 'refs/tags/') || contains(github.event.head_commit.message, '[beta]')
env:
APPCENTER_DISTRIBUTE_UPLOAD_BUILD_ONLY: true
APPCENTER_DISTRIBUTE_DESTINATIONS: Public
APPCENTER_APP_NAME: ClashX
APPCENTER_API_TOKEN: ${{ secrets.APPCENTER_API_TOKEN }}
APPCENTER_DISTRIBUTE_FILE: ClashX.dmg
APPCENTER_OWNER_NAME: ${{ secrets.APPCENTER_OWNER_NAME }}
APPCENTER_DISTRIBUTE_DSYM: "ClashX.app.dSYM.zip"
APPCENTER_DISTRIBUTE_RELEASE_NOTES: ${{ github.event.head_commit.message }}
run: |
appversion=`defaults read \`pwd\`/ClashX.app/Contents/Info.plist CFBundleShortVersionString`
buildVersion=`defaults read \`pwd\`/ClashX.app/Contents/Info.plist CFBundleVersion`
branch=${GITHUB_REF##*/}
version=$appversion.$branch
bundle exec fastlane run appcenter_upload version:${version} build_number:${buildVersion}
- name: upload build to github
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: |
ClashX.app.dSYM.zip
ClashX.dmg
draft: true
prerelease: true
- name: update gitpage
if: startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GITPAGE_TOKEN }}
run: 'curl -u yichengchen:$GITHUB_TOKEN -X POST https://api.github.com/repos/yichengchen/clashX/pages/builds -H "Accept: application/vnd.github.mister-fantastic-preview+json"'