Skip to content

Commit

Permalink
Merge pull request #513 from nimblehq/feature/510-github-actions-can-…
Browse files Browse the repository at this point in the history
…remove-custom-keychain-when-needed

[#510] GitHub actions can remove custom keychain when needed
  • Loading branch information
blyscuit authored Aug 30, 2023
2 parents 00e6deb + 3e873f8 commit 81d9e23
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/deploy_app_store.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,8 @@ jobs:
${{ env.DSYM_OUTPUT_PATH }}
env:
TAG_TYPE: App_Store

- name: Remove keychain
if: ${{ always() }}
run: bundle exec fastlane removeKeychain
continue-on-error: true
5 changes: 5 additions & 0 deletions .github/workflows/deploy_production_firebase.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,8 @@ jobs:
${{ env.DSYM_OUTPUT_PATH }}
env:
TAG_TYPE: Production_Firebase

- name: Remove keychain
if: ${{ always() }}
run: bundle exec fastlane removeKeychain
continue-on-error: true
5 changes: 5 additions & 0 deletions .github/workflows/deploy_staging_firebase.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,8 @@ jobs:
${{ env.DSYM_OUTPUT_PATH }}
env:
TAG_TYPE: Staging_Firebase

- name: Remove keychain
if: ${{ always() }}
run: bundle exec fastlane removeKeychain
continue-on-error: true
5 changes: 5 additions & 0 deletions .github/workflows/test_upload_build_to_firebase.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,8 @@ jobs:
${{ env.DSYM_OUTPUT_PATH }}
env:
TAG_TYPE: Staging_Firebase

- name: Remove keychain
if: ${{ always() }}
run: bundle exec fastlane removeKeychain
continue-on-error: true
5 changes: 5 additions & 0 deletions .github/workflows/test_upload_build_to_test_flight.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,8 @@ jobs:
ISSUER_ID: ${{ secrets.ISSUER_ID }}
SKIP_FIREBASE_DSYM: "true"
BUMP_APP_STORE_BUILD_NUMBER: "true"

- name: Remove keychain
if: ${{ always() }}
run: bundle exec fastlane removeKeychain
continue-on-error: true
2 changes: 1 addition & 1 deletion fastlane/Constants/Constant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ enum Constant {
static let appleStagingTeamId = "<#teamId#>"
static let appleProductionUserName = "<#userName#>"
static let appleProductionTeamId = "<#teamId#>"
static let keychainName = "github_action_keychain"
static let keychainName = "{PROJECT_NAME}_keychain"
static let matchURL = "[email protected]:{organization}/{repo}.git"

// MARK: - Path
Expand Down
5 changes: 5 additions & 0 deletions fastlane/Fastfile.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ class Fastfile: LaneFile {
environment: .production
)
}

func removeKeychainLane() {
desc("Delete keychain")
Keychain.remove()
}

// MARK: - Build

Expand Down
8 changes: 8 additions & 0 deletions fastlane/Helpers/Keychain.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
// Copyright © 2022 Nimble. All rights reserved.
//

import Foundation

enum Keychain {

static func create() {
Expand All @@ -17,4 +19,10 @@ enum Keychain {
timeout: 3600
)
}

static func remove() {
deleteKeychain(
name: .userDefined(Constant.keychainName)
)
}
}
7 changes: 6 additions & 1 deletion make.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@ usage() {
fi

cat << EOF
Usage: $PROGNAME --bundle-id [BUNDLE_ID_PRODUCTION] --bundle-id-staging [BUNDLE_ID_STAGING] --project-name [PROJECT_NAME]
Usage: $PROGNAME --bundle-id [BUNDLE_ID_PRODUCTION] --bundle-id-staging [BUNDLE_ID_STAGING] --project-name [PROJECT_NAME] --minimum-version [MINIMUM_VERSION] --interface [INTERFACE]
Set up an iOS app from tuist template.
Options:
-h, --help display this usage message and exit
-b, --bundle-id [BUNDLE_ID_PRODUCTION] the production id (i.e. com.example.package)
-s, --bundle-id-staging [BUNDLE_ID_STAGING] the staging id (i.e. com.example.package.staging)
-n, --project-name [PROJECT_NAME] the project name (i.e. MyApp)
-m, --minimum-version [MINIMUM_VERSION] the minimum version of the project (i.e. 14.0)
-i, --interface [INTERFACE] the user interface frameword (SwiftUI or UIKit)
EOF
exit 1
Expand Down Expand Up @@ -52,6 +53,10 @@ while [ $# -gt 0 ] ; do
project_name="$2"
shift
;;
-m|--minimum-version)
minimum_version="$2"
shift
;;
-i|--interface)
interface="$2"
shift
Expand Down

0 comments on commit 81d9e23

Please sign in to comment.