Skip to content

Commit

Permalink
ci: Updated XCloud script for status check (#292)
Browse files Browse the repository at this point in the history
* ci: Updated XCloud script for status check

* ci: Fixed script issue

* ci: Fixed script issue

* ci: Fixed script issue

* ci: Fixed script issue

* ci: Fixed script issue
  • Loading branch information
WindowsMEMZ authored Mar 1, 2024
1 parent 6bc1166 commit 44b7b1f
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 4 deletions.
2 changes: 2 additions & 0 deletions DarockBili.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,7 @@

/* Begin PBXFileReference section */
8C0557E02B7A0480009D9CD0 /* MeowBili.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = MeowBili.entitlements; sourceTree = "<group>"; };
8C617F5B2B924C5B000A3687 /* ci_post_clone.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = ci_post_clone.sh; sourceTree = "<group>"; };
8C617F3E2B92334B000A3687 /* SafariExtension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = SafariExtension.appex; sourceTree = BUILT_PRODUCTS_DIR; };
8C617F402B92334B000A3687 /* SafariWebExtensionHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SafariWebExtensionHandler.swift; sourceTree = "<group>"; };
8C617F432B92334B000A3687 /* _locales */ = {isa = PBXFileReference; lastKnownFileType = folder; path = _locales; sourceTree = "<group>"; };
Expand Down Expand Up @@ -828,6 +829,7 @@
children = (
8CB0D0232B88CEC40057EF1C /* ci_post_xcodebuild.sh */,
8CB0D0242B88D20F0057EF1C /* ci_pre_xcodebuild.sh */,
8C617F5B2B924C5B000A3687 /* ci_post_clone.sh */,
);
path = ci_scripts;
sourceTree = "<group>";
Expand Down
15 changes: 15 additions & 0 deletions ci_scripts/ci_post_clone.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

if [[ -n $CI_PULL_REQUEST_NUMBER ]];
then
brew install gh

gh api \
--method POST \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/repos/$CI_PULL_REQUEST_SOURCE_REPO/statuses/$CI_COMMIT \
-f state='pending' \
-f description='XCloud Building...' \
-f context='API Status Checker'
fi
25 changes: 22 additions & 3 deletions ci_scripts/ci_post_xcodebuild.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,28 @@
#!/bin/zsh
# ci_post_xcodebuild.sh
#!/bin/bash

if [[ "$CI_WORKFLOW" == "Canary Deploy" ]]; then
TESTFLIGHT_DIR_PATH=../TestFlight
mkdir $TESTFLIGHT_DIR_PATH
echo "CI 自动生成信息,24小时内的main分支的提交:\n" > $TESTFLIGHT_DIR_PATH/WhatToTest.zh-Hans.txt
git fetch -a --deepen 40 && git log --since="24 hours ago" main --pretty=format:"%s" >! $TESTFLIGHT_DIR_PATH/WhatToTest.zh-Hans.txt
git fetch -a --deepen 40 && git log --since="24 hours ago" main --pretty=format:"%s" >> $TESTFLIGHT_DIR_PATH/WhatToTest.zh-Hans.txt
elif [[ "$CI_WORKFLOW" == "Public Release" ]]; then
TESTFLIGHT_DIR_PATH=../TestFlight
mkdir $TESTFLIGHT_DIR_PATH
echo "当前语义化版本:$CI_TAG\n\nRelease Notes: https://github.com/Darock-Studio/Darock-Bili/releases/tag/$CI_TAG\n\n若要使用watchOS App,请打开“在Apple Watch上显示App”开关" > $TESTFLIGHT_DIR_PATH/WhatToTest.zh-Hans.txt
fi

if [[ -n $CI_PULL_REQUEST_NUMBER ]]; then
if [[ "$CI_XCODEBUILD_EXIT_CODE" == "0" ]]; then
NEW_STATUS=success
else
NEW_STATUS=failure
fi

gh api \
--method POST \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/repos/$CI_PULL_REQUEST_SOURCE_REPO/statuses/$CI_COMMIT \
-f state=$NEW_STATUS \
-f context='API Status Checker'
fi
2 changes: 1 addition & 1 deletion ci_scripts/ci_pre_xcodebuild.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/zsh
#!/bin/bash

if [ "$CI_WORKFLOW" = "Canary Deploy" ]; then
NEW_TEXT="Canary"
Expand Down

0 comments on commit 44b7b1f

Please sign in to comment.