From 4bed3dfa4ac03f363747f6733c0e8b831d89467c Mon Sep 17 00:00:00 2001 From: mrFq1 <1xxbx0il0@mozmail.com> Date: Mon, 26 Jun 2023 22:31:44 +0800 Subject: [PATCH] chore: build infos --- .github/workflows/main.yml | 27 +++++++++++++++++++++------ .github/workflows/pull_request.yaml | 29 ----------------------------- 2 files changed, 21 insertions(+), 35 deletions(-) delete mode 100644 .github/workflows/pull_request.yaml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2c2d590..ac84b36 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -18,9 +18,8 @@ jobs: with: fetch-depth: 0 - - name: test - run: git rev-list --count origin/master..origin/meta - + - uses: FranzDiebold/github-env-vars-action@v2 + - name: download meta core uses: robinraju/release-downloader@v1.8 with: @@ -34,13 +33,29 @@ jobs: 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 $CI_ACTION_REF_NAME" ClashX/Info.plist + /usr/libexec/PlistBuddy -c "Add gitCommit string $CI_SHA_SHORT" 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: install deps run: bash install_dependency.sh - - - name: build infos - run: python3 ClashX/add_build_info.py + - name: build + if: startsWith(github.ref, 'refs/tags/') run: xcodebuild archive -workspace ClashX.xcworkspace -scheme ClashX -archivePath archive/ClashX.xcarchive -showBuildTimingSummary -allowProvisioningUpdates - name: build-SwiftUI diff --git a/.github/workflows/pull_request.yaml b/.github/workflows/pull_request.yaml deleted file mode 100644 index 71df35e..0000000 --- a/.github/workflows/pull_request.yaml +++ /dev/null @@ -1,29 +0,0 @@ -name: ClashX - -on: [ pull_request ] - -env: - FASTLANE_SKIP_UPDATE_CHECK: true - -jobs: - build: - runs-on: macos-13 - steps: - - uses: actions/checkout@v3 - - - name: setup Go - uses: actions/setup-go@v3 - with: - go-version: 1.20.x - - - uses: maxim-lobanov/setup-xcode@v1 - with: - xcode-version: latest-stable - - - name: install deps - run: | - bash install_dependency.sh - - - name: check - run: | - bundle exec fastlane check