Skip to content

Commit

Permalink
Merge pull request #50 from WalletConnect/feat/automate-release
Browse files Browse the repository at this point in the history
  • Loading branch information
radeknovis authored Feb 1, 2024
2 parents 3952a3b + 4ffa39f commit 0813af9
Show file tree
Hide file tree
Showing 12 changed files with 128 additions and 51 deletions.
4 changes: 4 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
SCHEME = "Example"
APP_IDENTIFIER = "com.walletconnect.web3modal.sample"
MATCH_IDENTIFIERS = "com.walletconnect.web3modal.sample"
APPLE_ID = "6469691466"
34 changes: 34 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: release

on:
workflow_dispatch:

jobs:
build:
runs-on:
group: apple-silicon

steps:
- uses: actions/checkout@v3

- uses: actions/cache@v3
with:
path: |
.build
SourcePackagesCache
DerivedDataCache
key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}
restore-keys: |
${{ runner.os }}-spm-
- name: Release
shell: bash
env:
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}
GH_USER: ${{ secrets.GH_USER }}
APPLE_ISSUER_ID: ${{ secrets.APPLE_ISSUER_ID }}
APPLE_KEY_ID: ${{ secrets.APPLE_KEY_ID }}
APPLE_KEY_CONTENT: ${{ secrets.APPLE_KEY_CONTENT }}
run: |
make release TOKEN=$(echo -n $GH_USER:$GH_TOKEN | base64) PROJECT_ID=${{ secrets.RELEASE_PROJECT_ID }}
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
unit_tests:
./run_tests.sh --scheme swift-web3modal-Package

release:
fastlane release_testflight token:$(TOKEN) project_id:$(PROJECT_ID)
32 changes: 12 additions & 20 deletions Sample/Example.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,31 +14,28 @@
CF3B9AD02ACDBA3A00984D53 /* Web3Modal in Frameworks */ = {isa = PBXBuildFile; productRef = CF3B9ACF2ACDBA3A00984D53 /* Web3Modal */; };
CF3B9AD22ACDBA3A00984D53 /* Web3ModalUI in Frameworks */ = {isa = PBXBuildFile; productRef = CF3B9AD12ACDBA3A00984D53 /* Web3ModalUI */; };
CFA99B922AD0549F00EB5331 /* WCSocketFactory.swift in Sources */ = {isa = PBXBuildFile; fileRef = CFA99B912AD0549F00EB5331 /* WCSocketFactory.swift */; };
CFA99B962AD054A600EB5331 /* secrets.sample.json in Resources */ = {isa = PBXBuildFile; fileRef = CFA99B942AD054A600EB5331 /* secrets.sample.json */; };
CFA99B972AD054A600EB5331 /* Secrets.swift in Sources */ = {isa = PBXBuildFile; fileRef = CFA99B952AD054A600EB5331 /* Secrets.swift */; };
CFA99B992AD054CD00EB5331 /* secrets.json in Resources */ = {isa = PBXBuildFile; fileRef = CFA99B982AD054CD00EB5331 /* secrets.json */; };
CFD6A70F2ADE8DE2002B402C /* Atlantis in Frameworks */ = {isa = PBXBuildFile; productRef = CFD6A70E2ADE8DE2002B402C /* Atlantis */; };
CFD720782A9CC60600636CAF /* ExampleApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = CFD720772A9CC60600636CAF /* ExampleApp.swift */; };
CFD7207A2A9CC60600636CAF /* ComponentLibraryView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CFD720792A9CC60600636CAF /* ComponentLibraryView.swift */; };
CFD7207C2A9CC60700636CAF /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = CFD7207B2A9CC60700636CAF /* Assets.xcassets */; };
CFD720802A9CC60700636CAF /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = CFD7207F2A9CC60700636CAF /* Preview Assets.xcassets */; };
CFEAAF0A2B6C0B3A001565F5 /* InputConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = CFEAAF092B6C0B3A001565F5 /* InputConfig.swift */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
CF0BCCE42AB0886400A2866C /* ContentView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
CF533D032ADD411A00B3441C /* web3modal-swift */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = "web3modal-swift"; path = ..; sourceTree = "<group>"; };
CF74C5C62B323048007B0926 /* swift-web3modal-Package.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = "swift-web3modal-Package.xctestplan"; sourceTree = "<group>"; };
CFA99B912AD0549F00EB5331 /* WCSocketFactory.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WCSocketFactory.swift; sourceTree = "<group>"; };
CFA99B942AD054A600EB5331 /* secrets.sample.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = secrets.sample.json; sourceTree = "<group>"; };
CFA99B952AD054A600EB5331 /* Secrets.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Secrets.swift; sourceTree = "<group>"; };
CFA99B982AD054CD00EB5331 /* secrets.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = secrets.json; sourceTree = "<group>"; };
CFD6A7102ADE8E26002B402C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
CFD720742A9CC60600636CAF /* Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Example.app; sourceTree = BUILT_PRODUCTS_DIR; };
CFD720772A9CC60600636CAF /* ExampleApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExampleApp.swift; sourceTree = "<group>"; };
CFD720792A9CC60600636CAF /* ComponentLibraryView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ComponentLibraryView.swift; sourceTree = "<group>"; };
CFD7207B2A9CC60700636CAF /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
CFD7207D2A9CC60700636CAF /* Example.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Example.entitlements; sourceTree = "<group>"; };
CFD7207F2A9CC60700636CAF /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
CFEAAF082B6C0A58001565F5 /* Configuration.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Configuration.xcconfig; sourceTree = "<group>"; };
CFEAAF092B6C0B3A001565F5 /* InputConfig.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InputConfig.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand All @@ -58,16 +55,6 @@
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
CFA99B932AD054A600EB5331 /* Secrets */ = {
isa = PBXGroup;
children = (
CFA99B942AD054A600EB5331 /* secrets.sample.json */,
CFA99B982AD054CD00EB5331 /* secrets.json */,
CFA99B952AD054A600EB5331 /* Secrets.swift */,
);
path = Secrets;
sourceTree = "<group>";
};
CFD7206B2A9CC60600636CAF = {
isa = PBXGroup;
children = (
Expand All @@ -91,14 +78,15 @@
isa = PBXGroup;
children = (
CFD6A7102ADE8E26002B402C /* Info.plist */,
CFA99B932AD054A600EB5331 /* Secrets */,
CFA99B912AD0549F00EB5331 /* WCSocketFactory.swift */,
CFD720772A9CC60600636CAF /* ExampleApp.swift */,
CFD720792A9CC60600636CAF /* ComponentLibraryView.swift */,
CFEAAF082B6C0A58001565F5 /* Configuration.xcconfig */,
CF0BCCE42AB0886400A2866C /* ContentView.swift */,
CFD7207B2A9CC60700636CAF /* Assets.xcassets */,
CFD7207D2A9CC60700636CAF /* Example.entitlements */,
CFD7207E2A9CC60700636CAF /* Preview Content */,
CFEAAF092B6C0B3A001565F5 /* InputConfig.swift */,
);
path = Example;
sourceTree = "<group>";
Expand Down Expand Up @@ -191,9 +179,7 @@
buildActionMask = 2147483647;
files = (
CFD720802A9CC60700636CAF /* Preview Assets.xcassets in Resources */,
CFA99B992AD054CD00EB5331 /* secrets.json in Resources */,
CFD7207C2A9CC60700636CAF /* Assets.xcassets in Resources */,
CFA99B962AD054A600EB5331 /* secrets.sample.json in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -222,8 +208,8 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
CFEAAF0A2B6C0B3A001565F5 /* InputConfig.swift in Sources */,
CFD7207A2A9CC60600636CAF /* ComponentLibraryView.swift in Sources */,
CFA99B972AD054A600EB5331 /* Secrets.swift in Sources */,
CFD720782A9CC60600636CAF /* ExampleApp.swift in Sources */,
CF0BCCE52AB0886400A2866C /* ContentView.swift in Sources */,
CFA99B922AD0549F00EB5331 /* WCSocketFactory.swift in Sources */,
Expand All @@ -235,6 +221,7 @@
/* Begin XCBuildConfiguration section */
CFD720972A9CC60800636CAF /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = CFEAAF082B6C0A58001565F5 /* Configuration.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
Expand Down Expand Up @@ -298,6 +285,7 @@
};
CFD720982A9CC60800636CAF /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = CFEAAF082B6C0A58001565F5 /* Configuration.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
Expand Down Expand Up @@ -353,6 +341,7 @@
};
CFD7209A2A9CC60800636CAF /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = CFEAAF082B6C0A58001565F5 /* Configuration.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
Expand Down Expand Up @@ -387,6 +376,7 @@
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.walletconnect.web3modal.sample;
PRODUCT_NAME = "$(TARGET_NAME)";
PROJECT_ID = "$(PROJECT_ID)";
SDKROOT = auto;
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
Expand All @@ -398,6 +388,7 @@
};
CFD7209B2A9CC60800636CAF /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = CFEAAF082B6C0A58001565F5 /* Configuration.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
Expand Down Expand Up @@ -432,6 +423,7 @@
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.walletconnect.web3modal.sample;
PRODUCT_NAME = "$(TARGET_NAME)";
PROJECT_ID = "$(PROJECT_ID)";
SDKROOT = auto;
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
Expand Down
2 changes: 2 additions & 0 deletions Sample/Example/Configuration.xcconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Uncomment next line and paste your project id. Get this on: https://cloud.walletconnect.com/sign-in
PROJECT_ID = 9bfe94c9cbf74aaa0597094ef561f703
2 changes: 1 addition & 1 deletion Sample/Example/ExampleApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ struct ExampleApp: App {
Atlantis.start()
#endif

let projectId = Secrets.load().projectID
let projectId = InputConfig.projectId

// We're tracking Crash Reports / Issues from the Demo App to keep improving the SDK
SentrySDK.start { options in
Expand Down
6 changes: 2 additions & 4 deletions Sample/Example/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@
<array>
<string>w3mdapp</string>
</array>
<key>CFBundleURLSchemes</key>
<array>
<string>w3mdapp</string>
</array>
</dict>
</array>
<key>ITSAppUsesNonExemptEncryption</key>
Expand Down Expand Up @@ -70,5 +66,7 @@
<array>
<string>_Proxyman._tcp</string>
</array>
<key>PROJECT_ID</key>
<string>$(PROJECT_ID)</string>
</dict>
</plist>
16 changes: 16 additions & 0 deletions Sample/Example/InputConfig.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import Foundation

struct InputConfig {

static var projectId: String {
guard let projectId = config(for: "PROJECT_ID"), !projectId.isEmpty else {
fatalError("PROJECT_ID is either not defined or empty in Configuration.xcconfig")
}

return projectId
}

private static func config(for key: String) -> String? {
return Bundle.main.object(forInfoDictionaryKey: key) as? String
}
}
23 changes: 0 additions & 23 deletions Sample/Example/Secrets/Secrets.swift

This file was deleted.

3 changes: 0 additions & 3 deletions Sample/Example/Secrets/secrets.sample.json

This file was deleted.

2 changes: 2 additions & 0 deletions fastlane/Appfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
itc_team_id("123564616")
team_id("W5R8AG9K22")
52 changes: 52 additions & 0 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
ENV["FASTLANE_XCODEBUILD_SETTINGS_TIMEOUT"] = "120"

default_platform(:ios)

platform :ios do
lane :release_testflight do |options|
setup_ci
api_key = app_store_connect_api_key(
key_id: ENV["APPLE_KEY_ID"],
issuer_id: ENV["APPLE_ISSUER_ID"],
key_content: ENV["APPLE_KEY_CONTENT"],
duration: 1200,
in_house: false,
)
match(
readonly: false,
type: "appstore",
app_identifier: ENV["MATCH_IDENTIFIERS"],
git_url: "https://github.com/WalletConnect/match-swift.git",
git_basic_authorization: options[:token],
api_key: api_key,
include_all_certificates: true,
force_for_new_devices: true,
force_for_new_certificates: true
)
number = latest_testflight_build_number(
app_identifier: ENV["APP_IDENTIFIER"],
api_key: api_key
)
increment_build_number(
build_number: number + 1,
xcodeproj: "Sample/Example.xcodeproj"
)
gym(
configuration: "Release",
project: "Sample/Example.xcodeproj",
scheme: ENV["SCHEME"],
export_method: "app-store",
xcargs: "PROJECT_ID='#{options[:project_id]}"
)
upload_to_testflight(
apple_id: ENV["APPLE_ID"],
app_identifier: ENV["APP_IDENTIFIER"],
changelog: "Web3Modal sample app weekly build 🚀",
skip_waiting_for_build_processing: true
)
clean_build_artifacts()
end


end

0 comments on commit 0813af9

Please sign in to comment.