diff --git a/.github/workflows/beta-deployment.yml b/.github/workflows/beta-deployment.yml index 1ff36988..d094ddbd 100644 --- a/.github/workflows/beta-deployment.yml +++ b/.github/workflows/beta-deployment.yml @@ -19,21 +19,25 @@ jobs: name: Build and Test uses: ./.github/workflows/build-and-test.yml permissions: - security-events: write - actions: read + contents: read + secrets: inherit iosapptestflightdeployment: name: iOS App TestFlight Deployment needs: buildandtest uses: StanfordSpezi/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 - secrets: inherit + permissions: + contents: read with: googleserviceinfoplistpath: 'TemplateApplication/Supporting Files/GoogleService-Info.plist' setupsigning: true fastlanelane: beta + secrets: inherit deployfirebase: name: Deploy Firebase Project needs: iosapptestflightdeployment uses: StanfordBDHG/.github/.github/workflows/firebase-deploy.yml@v2 + permissions: + contents: read with: arguments: '--debug' secrets: diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 82a483fa..a28fe273 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -17,15 +17,23 @@ jobs: reuse_action: name: REUSE Compliance Check uses: StanfordBDHG/.github/.github/workflows/reuse.yml@v2 + permissions: + contents: read swiftlint: name: SwiftLint uses: StanfordBDHG/.github/.github/workflows/swiftlint.yml@v2 + permissions: + contents: read markdownlinkcheck: name: Markdown Link Check uses: StanfordBDHG/.github/.github/workflows/markdown-link-check.yml@v2 + permissions: + contents: read buildandtest: name: Build and Test uses: StanfordSpezi/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 + permissions: + contents: read with: artifactname: TemplateApplication.xcresult runsonlabels: '["macOS", "self-hosted"]' @@ -35,5 +43,9 @@ jobs: name: Upload Coverage Report needs: buildandtest uses: StanfordBDHG/.github/.github/workflows/create-and-upload-coverage-report.yml@v2 + permissions: + contents: read with: coveragereports: TemplateApplication.xcresult + secrets: + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/documentation-deployment.yml b/.github/workflows/documentation-deployment.yml index 72363510..861baf2f 100644 --- a/.github/workflows/documentation-deployment.yml +++ b/.github/workflows/documentation-deployment.yml @@ -1,5 +1,5 @@ # -# This source file is part of the Stanford Spezi open-source project +# This source file is part of the Stanford Spezi Template Application open-source project # # SPDX-FileCopyrightText: 2023 Stanford University and the project authors (see CONTRIBUTORS.md) # diff --git a/.github/workflows/monthly-markdown-link-check.yml.yml b/.github/workflows/monthly-markdown-link-check.yml.yml index 5a4792ce..812b8994 100644 --- a/.github/workflows/monthly-markdown-link-check.yml.yml +++ b/.github/workflows/monthly-markdown-link-check.yml.yml @@ -1,5 +1,5 @@ # -# This source file is part of the Stanford Spezi open-source project +# This source file is part of the Stanford Spezi Template Application open-source project # # SPDX-FileCopyrightText: 2023 Stanford University and the project authors (see CONTRIBUTORS.md) # @@ -17,3 +17,5 @@ jobs: markdown_link_check: name: Markdown Link Check uses: StanfordBDHG/.github/.github/workflows/markdown-link-check.yml@v2 + permissions: + contents: read diff --git a/Scripts/TEMPLATEREADME.md b/Scripts/TEMPLATEREADME.md index edf8df8e..ec8e9761 100644 --- a/Scripts/TEMPLATEREADME.md +++ b/Scripts/TEMPLATEREADME.md @@ -13,7 +13,7 @@ SPDX-License-Identifier: MIT This repository contains the Spezi Template Application. The Spezi Template Application is using the [Spezi](https://github.com/StanfordSpezi/Spezi) ecosystem and builds on top of the [{{SSTA}}](https://github.com/StanfordSpezi/Spezi{{TA}}). -> [!NOTE]  +> [!NOTE]  > Do you want to learn more about the {{SSTA}} and how to use, extend, and modify this application? Check out the [{{SSTA}} documentation](https://stanfordspezi.github.io/Spezi{{TA}}) diff --git a/Scripts/create.sh b/Scripts/create.sh index c2d845d0..167053cd 100644 --- a/Scripts/create.sh +++ b/Scripts/create.sh @@ -21,12 +21,13 @@ error_exit_help() { # Function to display help message show_help() { - echo "Usage: $0 --name --bundleIdentifier [--provisioningProfile ]" + echo "Usage: $0 --name --bundleIdentifier [--provisioningProfile ] [--firebaseProject ]" echo echo "Options:" echo " --name Name of the application. (required)" echo " --bundleIdentifier The iOS bundle identifier of the application. (required)" echo " --provisioningProfile The name of the iOS provisioning profile to build the application. (optional, defaults to the value of --name)" + echo " --firebaseProject The Firebase project identifier. (optional, defaults to the value of --name lowercased without spaces)" echo " --help Display this help and exit." } @@ -53,6 +54,11 @@ while [[ $# -gt 0 ]]; do shift # past argument shift # past value ;; + --firebaseProject) + firebaseProject="$2" + shift # past argument + shift # past value + ;; --help) show_help exit 0 @@ -72,17 +78,21 @@ if [ -z "$bundleIdentifier" ]; then error_exit_help "The --bundleIdentifier argument is required." fi -# Set default value for provisioningProfile if not provided -if [ -z "$provisioningProfile" ]; then - provisioningProfile="$appName" -fi - # Remove spaces from appName appNameNoSpaces="${appName// /}" # Convert appName to lowercase and remove spaces appNameLowerNoSpaces=$(echo "$appName" | tr '[:upper:]' '[:lower:]' | tr -d ' ') +# Set default value for provisioningProfile & firebaseProject if not provided +if [ -z "$provisioningProfile" ]; then + provisioningProfile="$appName" +fi + +if [ -z "$firebaseProject" ]; then + firebaseProject="$appNameLowerNoSpaces" +fi + # Testing the input: echo "Application Name: $appName" echo "Bundle Identifier: $bundleIdentifier" @@ -109,10 +119,10 @@ sed -i '' "s/${oldProvisioningProfileEscaped}/${provisioningProfileEscaped}/g" " # Firebase project name: firebaseProjectNameEscaped=$(sed 's:/:\\/:g' <<< "stanfordspezitemplateapp") -appNameLowerNoSpacesEscaped=$(sed 's:/:\\/:g' <<< "$appNameLowerNoSpaces") +firebaseProjectEscaped=$(sed 's:/:\\/:g' <<< "$firebaseProject") -sed -i '' "s/${firebaseProjectNameEscaped}/${appNameLowerNoSpacesEscaped}/g" ".firebaserc" -sed -i '' "s/${firebaseProjectNameEscaped}/${appNameLowerNoSpacesEscaped}/g" "./TemplateApplication/Supporting Files/GoogleService-Info.plist" +sed -i '' "s/${firebaseProjectNameEscaped}/${firebaseProjectEscaped}/g" ".firebaserc" +sed -i '' "s/${firebaseProjectNameEscaped}/${firebaseProjectEscaped}/g" "./TemplateApplication/Supporting Files/GoogleService-Info.plist" # Rename project and code: @@ -130,6 +140,7 @@ taFullEscaped=$(sed 's:/:\\/:g' <<< "TemplateApplication") newHeaderFileEscaped=$(sed 's:/:\\/:g' <<< "$appName based on the $sstaEscaped") appNameEscaped=$(sed 's:/:\\/:g' <<< "$appName") appNameNoSpacesEscaped=$(sed 's:/:\\/:g' <<< "$appNameNoSpaces") +appNameLowerNoSpacesEscaped=$(sed 's:/:\\/:g' <<< "$firebaseProject") find . -type f -not \( -path '*/.git/*' \) -not \( -path '*/Scripts/create.sh' \) -exec grep -Iq . {} \; -print | while read -r file; do sed -i '' "s/${projectNameLowercaseEscaped}/${appNameLowerNoSpacesEscaped}/g" "$file" || echo "Failed to process $file" diff --git a/TemplateApplication/Supporting Files/TemplateApplication.docc/Create.md b/TemplateApplication/Supporting Files/TemplateApplication.docc/Create.md index a0b4da96..7e94f316 100644 --- a/TemplateApplication/Supporting Files/TemplateApplication.docc/Create.md +++ b/TemplateApplication/Supporting Files/TemplateApplication.docc/Create.md @@ -26,14 +26,15 @@ The Spezi Template application repository provides a convenient script to rename The shell script can be called as follows: ```bash -$ sh Scripts/create.sh --name --bundleIdentifier [--provisioningProfile ] +$ sh Scripts/create.sh --name --bundleIdentifier [--provisioningProfile ] [--firebaseProject ] ``` Argument | Description --- | --- `--name` | Name of the application. (required) `--bundleIdentifier` | The iOS bundle identifier of the application. (required) -`--provisioningProfile` | The name of the iOS provisioning profile to build the application. (optional, defaults to the value of --name). +`--provisioningProfile` | The name of the iOS provisioning profile to build the application. (optional, defaults to the value of --name) +`--firebaseProject` | The Firebase project identifier. (optional, defaults to the value of --name lowercased without spaces) `--help` | Display help and exit. The following example shows renaming the application to "My Spezi App":