ClashX/.github/workflows/main.yml
2022-03-22 19:49:20 +08:00

98 lines
3.5 KiB
YAML

name: ClashX
on: [push]
env:
FASTLANE_SKIP_UPDATE_CHECK: true
DEVELOPER_DIR: /Applications/Xcode_13.1.app/Contents/Developer
jobs:
build:
runs-on: macos-11
steps:
- uses: actions/checkout@v2
- 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@v2
with:
go-version: 1.18.x
- name: install deps
run: |
bash install_dependency.sh
- name: update beta build version
if: contains(github.event.head_commit.message, '[beta]') && !startsWith(github.ref, 'refs/tags/')
run: |
bundle exec fastlane beta
bundle exec fastlane run set_info_plist_value path:ClashX/Info.plist key:BETA value:YES
- 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"
python SMJobBlessUtil.py check ClashX.app
echo "Check done"
- name: setup node
if: startsWith(github.ref, 'refs/tags/') || contains(github.event.head_commit.message, '[appcenter]')
uses: actions/setup-node@v1
with:
node-version: '10.x'
- name: create dmg
if: startsWith(github.ref, 'refs/tags/') || contains(github.event.head_commit.message, '[appcenter]')
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, '[notarize]')
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, '[appcenter]')
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 }}
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.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"'