110 lines
4.7 KiB
YAML
110 lines
4.7 KiB
YAML
name: ClashX
|
|
|
|
on:
|
|
push:
|
|
tags: [ v* ]
|
|
workflow_dispatch:
|
|
inputs:
|
|
logLevel:
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: macos-14
|
|
steps:
|
|
- uses: maxim-lobanov/setup-xcode@v1
|
|
with:
|
|
xcode-version: latest-stable
|
|
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: download meta core
|
|
uses: robinraju/release-downloader@v1.10
|
|
with:
|
|
repository: 'MetaCubeX/mihomo'
|
|
tag: "v1.18.7"
|
|
fileName: ".*darwin.*64-v.*.gz"
|
|
|
|
# releaseId: "62870807"
|
|
# fileName: ".*darwin.*64-alpha.*.gz"
|
|
|
|
out-file-path: "clash.meta"
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: build infos
|
|
run: |
|
|
/usr/libexec/PlistBuddy -c "Set CFBundleVersion $(git rev-list --count origin/master..origin/meta)" ClashX/Info.plist
|
|
/usr/libexec/PlistBuddy -c "Set CFBundleShortVersionString $(git describe --tags --abbrev=0)" ClashX/Info.plist
|
|
/usr/libexec/PlistBuddy -c "Add coreVersion string $(ls clash.meta | grep -m1 "" | sed -ne 's/.*64-\(.*\).gz/\1/p')" ClashX/Info.plist
|
|
/usr/libexec/PlistBuddy -c "Add gitBranch string $GITHUB_REF_NAME" ClashX/Info.plist
|
|
/usr/libexec/PlistBuddy -c "Add gitCommit string ${GITHUB_SHA::7}" ClashX/Info.plist
|
|
/usr/libexec/PlistBuddy -c "Add buildTime string $(date +%Y-%m-%d\ %H:%M)" ClashX/Info.plist
|
|
|
|
/usr/libexec/PlistBuddy -c 'Print CFBundleVersion' ClashX/Info.plist
|
|
/usr/libexec/PlistBuddy -c 'Print CFBundleShortVersionString' ClashX/Info.plist
|
|
/usr/libexec/PlistBuddy -c 'Print coreVersion' ClashX/Info.plist
|
|
/usr/libexec/PlistBuddy -c 'Print gitBranch' ClashX/Info.plist
|
|
/usr/libexec/PlistBuddy -c 'Print gitCommit' ClashX/Info.plist
|
|
/usr/libexec/PlistBuddy -c 'Print buildTime' ClashX/Info.plist
|
|
|
|
- name: swiftui build infos
|
|
run: |
|
|
/usr/libexec/PlistBuddy -c "Set CFBundleVersion $(git rev-list --count origin/master..origin/meta)" ClashX/ClashX\ Meta\ SwiftUI-Info.plist
|
|
/usr/libexec/PlistBuddy -c "Set CFBundleShortVersionString $(git describe --tags --abbrev=0)" ClashX/ClashX\ Meta\ SwiftUI-Info.plist
|
|
/usr/libexec/PlistBuddy -c "Add coreVersion string $(ls clash.meta | grep -m1 "" | sed -ne 's/.*64-\(.*\).gz/\1/p')" ClashX/ClashX\ Meta\ SwiftUI-Info.plist
|
|
/usr/libexec/PlistBuddy -c "Add gitBranch string $GITHUB_REF_NAME" ClashX/ClashX\ Meta\ SwiftUI-Info.plist
|
|
/usr/libexec/PlistBuddy -c "Add gitCommit string ${GITHUB_SHA::7}" ClashX/ClashX\ Meta\ SwiftUI-Info.plist
|
|
/usr/libexec/PlistBuddy -c "Add buildTime string $(date +%Y-%m-%d\ %H:%M)" ClashX/ClashX\ Meta\ SwiftUI-Info.plist
|
|
|
|
/usr/libexec/PlistBuddy -c 'Print CFBundleVersion' ClashX/ClashX\ Meta\ SwiftUI-Info.plist
|
|
/usr/libexec/PlistBuddy -c 'Print CFBundleShortVersionString' ClashX/ClashX\ Meta\ SwiftUI-Info.plist
|
|
/usr/libexec/PlistBuddy -c 'Print coreVersion' ClashX/ClashX\ Meta\ SwiftUI-Info.plist
|
|
/usr/libexec/PlistBuddy -c 'Print gitBranch' ClashX/ClashX\ Meta\ SwiftUI-Info.plist
|
|
/usr/libexec/PlistBuddy -c 'Print gitCommit' ClashX/ClashX\ Meta\ SwiftUI-Info.plist
|
|
/usr/libexec/PlistBuddy -c 'Print buildTime' ClashX/ClashX\ Meta\ SwiftUI-Info.plist
|
|
|
|
- name: install deps
|
|
run: |
|
|
bash install_dependency.sh
|
|
xcodebuild -resolvePackageDependencies -project ClashX.xcodeproj
|
|
|
|
|
|
- name: build
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
run: |
|
|
xcodebuild archive -project ClashX.xcodeproj -scheme ClashX\ Meta -archivePath archive/ClashX.xcarchive -showBuildTimingSummary -allowProvisioningUpdates
|
|
|
|
|
|
- name: build-SwiftUI
|
|
run: |
|
|
xcodebuild archive -project ClashX.xcodeproj -scheme ClashX\ Meta\ SwiftUI -archivePath archive/ClashX\ SwiftUI.xcarchive -showBuildTimingSummary -allowProvisioningUpdates
|
|
|
|
|
|
- name: create zip
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
run: ditto -c -k --sequesterRsrc --keepParent archive/ClashX.xcarchive/Products/Applications/ClashX\ Meta.app "ClashX Meta.zip"
|
|
|
|
- name: create SwiftUI zip
|
|
run: ditto -c -k --sequesterRsrc --keepParent archive/ClashX\ SwiftUI.xcarchive/Products/Applications/ClashX\ Meta.app "ClashX Meta macOS 12.0+.zip"
|
|
|
|
|
|
- name: upload Artifact
|
|
uses: actions/upload-artifact@v4
|
|
if: "!startsWith(github.ref, 'refs/tags/')"
|
|
with:
|
|
name: "ClashX Meta.zip"
|
|
path: "*.zip"
|
|
|
|
- name: upload build to github
|
|
uses: softprops/action-gh-release@v2
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
generate_release_notes: true
|
|
files: |
|
|
ClashX Meta.zip
|
|
ClashX Meta macOS 12.0+.zip
|
|
|