Skip to content

Commit

Permalink
ci: 修复未有权限用户无法打包的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
marchyang committed Sep 17, 2023
1 parent 20056cb commit 6b6d978
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 26 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ jobs:
runs-on: macos-13
needs: create_release

env:
USE_CODE_SIGN: ${{ !inputs.disable_sign && github.actor_id == github.repository_owner_id && 'enable' || 'disable' }}

steps:
- uses: actions/checkout@v2

Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ on:
jobs:
build-test:
runs-on: macos-13

env:
USE_CODE_SIGN: ${{ !inputs.disable_sign && github.actor_id == github.repository_owner_id && 'enable' || 'disable' }}

steps:
- uses: actions/checkout@v1
Expand All @@ -41,8 +44,6 @@ jobs:
p12-password: ${{ secrets.CERTIFICATES_INSTALLER_P12_PASSWORD }}

- name: build Fire.app
env:
USE_CODE_SIGN: ${{ !inputs.disable_sign && github.actor_id == github.repository_owner_id && 'enable' || 'disable' }}
run: ./scripts/a_build_app.sh

- name: build FireInstaller.pkg
Expand Down
17 changes: 10 additions & 7 deletions scripts/a_build_app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,13 @@ echo $vv

xcodebuild archive -project "$PROJECT" -scheme Fire -archivePath "$EXPORT_ARCHIVE" -configuration Release $BUILD_FLAG || { echo "Archive Failed:"; exit 1; }

# # cp -a ./archive.xcarchive/Products/Applications/*.app "${BUILD_DIR}"

# # rm -rf ./archive.xcarchive

/usr/bin/xcodebuild -exportArchive -archivePath "$EXPORT_ARCHIVE" -exportOptionsPlist "$PROJECT_ROOT/scripts/ExportOptions.plist" -exportPath "$EXPORT_PATH" $BUILD_FLAG || { echo "Export Archive Failed : xcodebuild exportArchive action failed"; exit 1; }

ditto -c -k --sequesterRsrc --keepParent "$EXPORT_APP" "$EXPORT_ZIP"
if [[ $USE_CODE_SIGN == "disable" ]]
then
echo "export without code signing"
ditto "$EXPORT_ARCHIVE/Products/Applications/$TARGET.app" "$EXPORT_APP"
ls "$EXPORT_PATH"
else
/usr/bin/xcodebuild -exportArchive -archivePath "$EXPORT_ARCHIVE" -exportOptionsPlist "$PROJECT_ROOT/scripts/ExportOptions.plist" -exportPath "$EXPORT_PATH" $BUILD_FLAG || { echo "Export Archive Failed : xcodebuild exportArchive action failed"; exit 1; }

ditto -c -k --sequesterRsrc --keepParent "$EXPORT_APP" "$EXPORT_ZIP"
fi
17 changes: 7 additions & 10 deletions scripts/b_build_installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,13 @@ mkdir -p "${INSTALLER_ROOT}"
cp -R "$EXPORT_PATH/${TARGET}.app" "${INSTALLER_ROOT}"
echo $INSTALLER_ROOT

pkgbuild \
--info "${PROJECT_ROOT}/package/PackageInfo" \
--root "${INSTALLER_ROOT}" \
--component-plist "${PROJECT_ROOT}/package/component.plist" \
--identifier "${BUNDLE_IDENTIFIER}" \
--version "${Version}" \
--install-location "${INSTALL_LOCATION}" \
--scripts "${PROJECT_ROOT}/package/scripts" \
--sign "Developer ID Installer: Yongbang Yang" \
"$EXPORT_INSTALLER"
if [[ $USE_CODE_SIGN == "disable" ]]
then
echo "build installer without signing"
pkgbuild --info "${PROJECT_ROOT}/package/PackageInfo" --root "${INSTALLER_ROOT}" --component-plist "${PROJECT_ROOT}/package/component.plist" --identifier "${BUNDLE_IDENTIFIER}" --version "${Version}" --install-location "${INSTALL_LOCATION}" --scripts "${PROJECT_ROOT}/package/scripts" "$EXPORT_INSTALLER"
else
pkgbuild --info "${PROJECT_ROOT}/package/PackageInfo" --root "${INSTALLER_ROOT}" --component-plist "${PROJECT_ROOT}/package/component.plist" --identifier "${BUNDLE_IDENTIFIER}" --version "${Version}" --install-location "${INSTALL_LOCATION}" --scripts "${PROJECT_ROOT}/package/scripts" --sign "Developer ID Installer: Yongbang Yang" "$EXPORT_INSTALLER"
fi

# pack zip for update
zip "$EXPORT_INSTALLER_ZIP" "$EXPORT_INSTALLER"
Expand Down
6 changes: 0 additions & 6 deletions scripts/c_notarize_installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,9 @@ if [[ $TEAM_ID == "" ]]; then
exit 1
fi



PROJECT_ROOT="$(cd "$(dirname "$BASH_SOURCE")/.."; pwd)"
source "$PROJECT_ROOT/scripts/common.sh"

PRODUCT_BUNDLE_IDENTIFIER="com.qwertyyb.inputmethod.Fire"

# Submit the finished deliverables for notarization. The "--primary-bundle-id"
# argument is only used for the response email.
echo "notarize app"

notarize_response=`xcrun notarytool submit ${EXPORT_INSTALLER} --apple-id "$AC_USERNAME" --password "$AC_PASSWORD" --team-id "$TEAM_ID" --wait --progress`
Expand Down
3 changes: 2 additions & 1 deletion scripts/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ fi

echo "BUILD_FLAG=$BUILD_FLAG"
echo "PROJECT_ROOT=$PROJECT_ROOT"
echo "EXPORT_PATH=$EXPORT_PATH"
echo "EXPORT_PATH=$EXPORT_PATH"
echo "USE_CODE_SIGN=$USE_CODE_SIGN"

0 comments on commit 6b6d978

Please sign in to comment.