Release #85
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: "Version to release" | |
required: true | |
jobs: | |
release: | |
name: Release | |
runs-on: macOS-14-xlarge | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Use Xcode 15.0.1 | |
run: sudo xcode-select -switch /Applications/Xcode_15.0.1.app | |
- name: Check for unreleased section in changelog | |
run: grep "## unreleased" CHANGELOG.md || (echo "::error::No unreleased section found in CHANGELOG"; exit 1) | |
- name: Set git username and email | |
run: | | |
git config user.name braintreeps | |
git config user.email [email protected] | |
- name: Remove SPMTest app to prevent Carthage timeout | |
run: | | |
rm -rf SampleApps/SPMTest | |
git add SampleApps/SPMTest | |
git commit -m 'Remove SPMTest app to avoid Carthage timeout' | |
- name: Update version | |
run: | | |
today=$(date +'%Y-%m-%d') | |
sed -i '' 's/## unreleased.*/## '"${{ github.event.inputs.version }}"' ('"$today"')/' CHANGELOG.md | |
sed -i '' 's/\(s\.version *= *\).*/\1"'"${{ github.event.inputs.version }}"'\"/' Braintree.podspec | |
sed -i '' 's/braintreeSDKVersion: String =.*/braintreeSDKVersion: String = "${{ github.event.inputs.version }}"/' Sources/BraintreeCore/BTCoreConstants.swift | |
plutil -replace CFBundleVersion -string ${{ github.event.inputs.version }} -- 'Demo/Application/Supporting Files/Braintree-Demo-Info.plist' | |
plutil -replace CFBundleShortVersionString -string ${{ github.event.inputs.version }} -- 'Demo/Application/Supporting Files/Braintree-Demo-Info.plist' | |
plutil -replace CFBundleVersion -string ${{ github.event.inputs.version }} -- 'Sources/BraintreeCore/Info.plist' | |
plutil -replace CFBundleShortVersionString -string ${{ github.event.inputs.version }} -- 'Sources/BraintreeCore/Info.plist' | |
git add . | |
git commit -m 'Bump version to ${{ github.event.inputs.version }}' | |
git tag ${{ github.event.inputs.version }} -a -m 'Release ${{ github.event.inputs.version }}' | |
- name: Restore SPMTest app for development purposes | |
run: | | |
git revert $(git rev-parse HEAD^1) --no-edit | |
- name: Push commits and tag | |
run: git push origin HEAD ${{ github.event.inputs.version }} | |
- name: Save changelog entries to a file | |
run: | | |
sed -e '1,/##/d' -e '/##/,$d' CHANGELOG.md > changelog_entries.md | |
- name: Create GitHub release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.event.inputs.version }} | |
release_name: ${{ github.event.inputs.version }} | |
body_path: changelog_entries.md | |
draft: false | |
prerelease: false | |
- name: Create Carthage pre-built xcframeworks | |
run: | | |
rm -rf SampleApps/SPMTest | |
rm -rf Carthage | |
carthage build --no-skip-current --use-xcframeworks | |
rm -rf Carthage/Build/BraintreeTestShared.xcframework | |
zip -r Braintree.xcframework.zip Carthage | |
git checkout SampleApps/SPMTest | |
- name: Upload Carthage pre-built xcframeworks to GitHub release | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: Braintree.xcframework.zip | |
asset_name: Braintree.xcframework.zip | |
asset_content_type: application/zip | |
- name: Publish to CocoaPods | |
env: | |
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }} | |
run: pod trunk push Braintree.podspec | |
- name: Publish reference docs | |
run: | | |
gem install jazzy | |
brew install sourcekitten | |
# run sourcekitten on each Swift module individually | |
sourcekitten doc -- -workspace Braintree.xcworkspace -scheme BraintreeCore -destination 'name=iPhone 14,platform=iOS Simulator' > braintree-core.json | |
sourcekitten doc -- -workspace Braintree.xcworkspace -scheme BraintreePayPalNativeCheckout -destination 'name=iPhone 14,platform=iOS Simulator' > braintree-pay-pal-native-checkout.json | |
sourcekitten doc -- -workspace Braintree.xcworkspace -scheme BraintreeSEPADirectDebit -destination 'name=iPhone 14,platform=iOS Simulator' > braintree-sepa-direct-debit.json | |
sourcekitten doc -- -workspace Braintree.xcworkspace -scheme BraintreeAmericanExpress -destination 'name=iPhone 14,platform=iOS Simulator' > braintree-american-express.json | |
sourcekitten doc -- -workspace Braintree.xcworkspace -scheme BraintreeDataCollector -destination 'name=iPhone 14,platform=iOS Simulator' > braintree-data-collector.json | |
sourcekitten doc -- -workspace Braintree.xcworkspace -scheme BraintreeApplePay -destination 'name=iPhone 14,platform=iOS Simulator' > braintree-apple-pay.json | |
sourcekitten doc -- -workspace Braintree.xcworkspace -scheme BraintreeLocalPayment -destination 'name=iPhone 14,platform=iOS Simulator' > braintree-local-payment.json | |
sourcekitten doc -- -workspace Braintree.xcworkspace -scheme BraintreeThreeDSecure -destination 'name=iPhone 14,platform=iOS Simulator' > braintree-three-d-secure.json | |
sourcekitten doc -- -workspace Braintree.xcworkspace -scheme BraintreeCard -destination 'name=iPhone 14,platform=iOS Simulator' > braintree-card.json | |
sourcekitten doc -- -workspace Braintree.xcworkspace -scheme BraintreePayPal -destination 'name=iPhone 14,platform=iOS Simulator' > braintree-paypal.json | |
sourcekitten doc -- -workspace Braintree.xcworkspace -scheme BraintreeVenmo -destination 'name=iPhone 14,platform=iOS Simulator' > braintree-venmo.json | |
sourcekitten doc -- -workspace Braintree.xcworkspace -scheme BraintreePayPalMessaging -destination 'name=iPhone 14,platform=iOS Simulator' > braintree-paypal-messaging.json | |
sourcekitten doc -- -workspace Braintree.xcworkspace -scheme BraintreeShopperInsights -destination 'name=iPhone 14,platform=iOS Simulator' > braintree-shopper-insights.json | |
# merge sourcekitten output | |
jq -s '.[0] + .[1] + .[2] + .[3] + .[4] + .[5] + .[6] + .[7] + .[8] + .[9] + .[10] + .[11] + .[12]' braintree-core.json braintree-pay-pal-native-checkout.json braintree-sepa-direct-debit.json braintree-american-express.json braintree-data-collector.json braintree-apple-pay.json braintree-local-payment.json braintree-three-d-secure.json braintree-card.json braintree-paypal.json braintree-venmo.json braintree-paypal-messaging.json braintree-shopper-insights.json > swiftDoc.json | |
jazzy \ | |
--sourcekitten-sourcefile swiftDoc.json \ | |
--author Braintree \ | |
--author_url http://braintreepayments.com \ | |
--github_url https://github.com/braintree/braintree_ios \ | |
--github-file-prefix https://github.com/braintree/braintree_ios/tree/${{ github.event.inputs.version }} \ | |
--theme fullwidth \ | |
--output ${{ github.event.inputs.version }} | |
git checkout gh-pages | |
ln -sfn ${{ github.event.inputs.version }} current | |
git add current ${{ github.event.inputs.version }} | |
git commit -m "Publish ${{ github.event.inputs.version }} docs to github pages" | |
git push |