diff --git a/DarockBili.xcodeproj/project.pbxproj b/DarockBili.xcodeproj/project.pbxproj index a49382e4d..0774c6601 100644 --- a/DarockBili.xcodeproj/project.pbxproj +++ b/DarockBili.xcodeproj/project.pbxproj @@ -379,6 +379,7 @@ /* Begin PBXFileReference section */ 8C0557E02B7A0480009D9CD0 /* MeowBili.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = MeowBili.entitlements; sourceTree = ""; }; + 8C617F5B2B924C5B000A3687 /* ci_post_clone.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = ci_post_clone.sh; sourceTree = ""; }; 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 = ""; }; 8C617F432B92334B000A3687 /* _locales */ = {isa = PBXFileReference; lastKnownFileType = folder; path = _locales; sourceTree = ""; }; @@ -828,6 +829,7 @@ children = ( 8CB0D0232B88CEC40057EF1C /* ci_post_xcodebuild.sh */, 8CB0D0242B88D20F0057EF1C /* ci_pre_xcodebuild.sh */, + 8C617F5B2B924C5B000A3687 /* ci_post_clone.sh */, ); path = ci_scripts; sourceTree = ""; diff --git a/ci_scripts/ci_post_clone.sh b/ci_scripts/ci_post_clone.sh new file mode 100755 index 000000000..49fd43e58 --- /dev/null +++ b/ci_scripts/ci_post_clone.sh @@ -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 diff --git a/ci_scripts/ci_post_xcodebuild.sh b/ci_scripts/ci_post_xcodebuild.sh index d8a73613b..83fa36597 100755 --- a/ci_scripts/ci_post_xcodebuild.sh +++ b/ci_scripts/ci_post_xcodebuild.sh @@ -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 diff --git a/ci_scripts/ci_pre_xcodebuild.sh b/ci_scripts/ci_pre_xcodebuild.sh index 5a15777f3..d165f6702 100755 --- a/ci_scripts/ci_pre_xcodebuild.sh +++ b/ci_scripts/ci_pre_xcodebuild.sh @@ -1,4 +1,4 @@ -#!/bin/zsh +#!/bin/bash if [ "$CI_WORKFLOW" = "Canary Deploy" ]; then NEW_TEXT="Canary"