Skip to content

Commit

Permalink
Automate Deployment & Firebase Setup (#54)
Browse files Browse the repository at this point in the history
# Automate Deployment & Firebase Setup

## ⚙️ Release Notes 
- Fix Fastlane deployment setup
- Add Firebase Project 
- Automate Firebase deployment


## 📝 Code of Conduct & Contributing Guidelines 

By submitting creating this pull request, you agree to follow our [Code
of
Conduct](https://github.com/StanfordSpezi/.github/blob/main/CODE_OF_CONDUCT.md)
and [Contributing
Guidelines](https://github.com/StanfordSpezi/.github/blob/main/CONTRIBUTING.md):
- [x] I agree to follow the [Code of
Conduct](https://github.com/StanfordSpezi/.github/blob/main/CODE_OF_CONDUCT.md)
and [Contributing
Guidelines](https://github.com/StanfordSpezi/.github/blob/main/CONTRIBUTING.md).
  • Loading branch information
PSchmiedmayer authored Nov 5, 2023
1 parent 5b529c2 commit a7a84e4
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .firebaserc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"projects": {
"default": "spezitemplateapplication"
"default": "stanfordspezitemplateapp"
}
}
9 changes: 9 additions & 0 deletions .github/workflows/beta-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,14 @@ jobs:
uses: StanfordSpezi/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2
secrets: inherit
with:
googleserviceinfoplistpath: 'TemplateApplication/Supporting Files/GoogleService-Info.plist'
setupsigning: true
fastlanelane: beta
deployfirebase:
name: Deploy Firebase Project
needs: iosapptestflightdeployment
uses: StanfordBDHG/.github/.github/workflows/firebase-deploy.yml@v2
with:
arguments: '--debug'
secrets:
GOOGLE_APPLICATION_CREDENTIALS_BASE64: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS_BASE64 }}
12 changes: 6 additions & 6 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@ on:
jobs:
reuse_action:
name: REUSE Compliance Check
uses: StanfordSpezi/.github/.github/workflows/reuse.yml@v2
uses: StanfordBDHG/.github/.github/workflows/reuse.yml@v2
swiftlint:
name: SwiftLint
uses: StanfordSpezi/.github/.github/workflows/swiftlint.yml@v2
uses: StanfordBDHG/.github/.github/workflows/swiftlint.yml@v2
markdownlinkcheck:
name: Markdown Link Check
uses: StanfordBDHG/.github/.github/workflows/markdown-link-check.yml@v2
buildandtest:
name: Build and Test
uses: StanfordSpezi/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2
Expand All @@ -31,9 +34,6 @@ jobs:
uploadcoveragereport:
name: Upload Coverage Report
needs: buildandtest
uses: StanfordSpezi/.github/.github/workflows/create-and-upload-coverage-report.yml@v2
uses: StanfordBDHG/.github/.github/workflows/create-and-upload-coverage-report.yml@v2
with:
coveragereports: TemplateApplication.xcresult
markdown_link_check:
name: Markdown Link Check
uses: StanfordBDHG/.github/.github/workflows/markdown-link-check.yml@v2
2 changes: 1 addition & 1 deletion .github/workflows/monthly-markdown-link-check.yml.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ on:
jobs:
markdown_link_check:
name: Markdown Link Check
uses: StanfordBDHG/.github/.github/workflows/markdown-link-check.yml@v2
uses: StanfordBDHG/.github/.github/workflows/markdown-link-check.yml@v2
19 changes: 17 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ You can start using the application without any additional installations if you
The application also provides a [Firebase Firestore](https://firebase.google.com/docs/firestore)-based data upload and [Firebase Authentication](https://firebase.google.com/docs/auth) login & sign-up.
It is required to have the [Firebase Emulator Suite](https://firebase.google.com/docs/emulator-suite) to be up and running to use these features to build and test the application locally. Please follow the [installation instructions](https://firebase.google.com/docs/emulator-suite/install_and_configure).

You do not have to make any modifications to the Firebase configuration, login into the `firebase` CLI using your Google account, or create a project in Firebase to run, build, and test the application!
> [!NOTE]
> You do not have to make any modifications to the Firebase configuration, login into the `firebase` CLI using your Google account, or create a project in Firebase to run, build, and test the application!
Startup the [Firebase Emulator Suite](https://firebase.google.com/docs/emulator-suite) using
```
Expand All @@ -53,6 +54,20 @@ $ firebase emulators:start

After the emulators have started up, you can run the application in your simulator to build, test, and run the application and see the results show up in Firebase.

If you want to connect your project to a development or production Firebase cloud project, you can provide your [`GoogleService-Info.plist`](https://firebase.google.com/docs/ios/setup) in a base 64 representation in the [GitHub secrets](https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions) (`GOOGLE_SERVICE_INFO_PLIST_BASE64`) of your project where it is picked up and loaded in the configured path setup in the [`beta-deployment.yml`](.github/workflows/beta-deployment.yml) [GitHub Action](https://docs.github.com/en/actions) using the `googleserviceinfoplistpath` parameter that needs to be adapted to your project structure.

You can generate a base 64 representation of a file after you [navigated into the folder](https://en.wikipedia.org/wiki/Cd_(command)#Usage) where you have downloaded your [`GoogleService-Info.plist`](https://firebase.google.com/docs/ios/setup) file to.
```shell
base64 -i GoogleService-Info.plist
```

> [!WARNING]
> We do **not recommend** to commit your Firebase secrets and configuration file to your project. While it can extract the file from the deployed application, we encourage open-source projects to make it clear to contributors to set up their own Firebase project.
The deployment requires you to store your Google service account JSON credentials in a base 64 representation in the `GOOGLE_APPLICATION_CREDENTIALS_BASE64`. You can learn more about how to generate the JSON in the [Firebase documentation](https://firebase.google.com/docs/app-distribution/authenticate-service-account). The service account must have the minimally required permissions (not the `Firebase App Distribution Admin` role) as documented at https://firebase.google.com/docs/projects/iam/roles-predefined for your deployment needs and setup.

Be sure to update your `.firebaserc` project name and placeholder `GoogleService-Info.plist` project identifier to always reflect the name of your project and all security rules to reflect any changes in your application.


### Other Configuration Options

Expand Down Expand Up @@ -130,7 +145,7 @@ This project is based on [ContinuousDelivery Example by Paul Schmiedmayer](https

## License

This project is licensed under the MIT License. See [Licenses](https://github.com/StanfordSpezi/Spezi/tree/main/LICENSES) for more information.
This project is licensed under the MIT License. See [Licenses](LICENSES) for more information.

![Spezi Footer](https://raw.githubusercontent.com/StanfordSpezi/.github/main/assets/FooterLight.png#gh-light-mode-only)
![Spezi Footer](https://raw.githubusercontent.com/StanfordSpezi/.github/main/assets/FooterDark.png#gh-dark-mode-only)
5 changes: 4 additions & 1 deletion TemplateApplication.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1012,10 +1012,12 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = "TemplateApplication/Supporting Files/TemplateApplication.entitlements";
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "";
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = 637867499T;
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = "TemplateApplication/Supporting Files/Info.plist";
Expand All @@ -1041,6 +1043,7 @@
PRODUCT_BUNDLE_IDENTIFIER = edu.stanford.spezi.templateapplication;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "Spezi Template Application";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>BUNDLE_ID</key>
<string>edu.stanford.spezi.templateapplication</string>
<key>PROJECT_ID</key>
<string>spezitemplateapplication</string>
<string>stanfordspezitemplateapp</string>
<key>STORAGE_BUCKET</key>
<string>STORAGE_BUCKET</string>
<key>IS_ADS_ENABLED</key>
Expand Down

0 comments on commit a7a84e4

Please sign in to comment.