Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Replace AppCenter in favor of Firebase App Distribution in UnoA… #420

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions .azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,9 @@ stages:
- template: build/stage-release-appcenter.yml
parameters:
applicationEnvironment: Staging
deploymentEnvironment: AppCenter
appCenterWindowsSlug: $(AppCenterWindowsSlug)
appCenteriOSSlug: $(AppCenteriOSSlug)
appCenterAndroidSlug: $(AppCenterAndroidSlug)
androidKeyStoreFile: $(InternalKeystore)
deploymentEnvironment: Firebase App Distribution
androidVariableGroup: 'ApplicationTemplate.Distribution.Internal.Android'
appCenterServiceConnectionName: $(AppCenterServiceConnection)
appCenterDistributionGroup: $(AppCenterDistributionGroup)
serviceConnectionKeyFileName: $(FirebaseAppDistributionServiceConnection)

- template: build/stage-release-appstore.yml
parameters:
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Prefix your items with `(Template)` if the change is about the template and not

## 3.6.X
- Added conventional commit validation stage `stage-commit-validation.yml`
- Replacing Appcenter with Firebase app distribution for android.

## 3.5.X
- Bump Uno packages to 5.2.121 to fix a crash on iOS.
Expand Down
164 changes: 73 additions & 91 deletions build/stage-release-appcenter.yml
Original file line number Diff line number Diff line change
@@ -1,110 +1,92 @@
parameters:
parameters:
applicationEnvironment: '' # e.g. "Staging", "Production"
deploymentEnvironment: '' # e.g. "GooglePlay", "AppStore", "AppCenter"
appCenterWindowsSlug: ''
appCenteriOSSlug: ''
appCenterAndroidSlug: ''
androidKeyStoreFile: ''
deploymentEnvironment: '' # e.g. "GooglePlay", "AppStore", "AppCenter" "Firebase App Distribution"
androidVariableGroup: ''
appCenterServiceConnectionName: ''
appCenterDistributionGroup: ''
serviceConnectionKeyFileName: ""

jobs:
- deployment: AppCenter_Android
- deployment: Firebase_Android
pool:
vmImage: $(windowsHostedAgentImage)
variables:
- name: artifactName
value: $(AndroidArtifactName)_${{ parameters.applicationEnvironment }}
- name: releaseNotesArtifactName
value: ReleaseNotes_${{ parameters.applicationEnvironment }}
- group: ${{ parameters.androidVariableGroup }}
- name: pathToAab
value: '$(Pipeline.Workspace)/$(AndroidArtifactName)_${{ parameters.applicationEnvironment }}/*Signed.aab'
environment: ${{ parameters.deploymentEnvironment }}
strategy:
runOnce:
deploy:
steps:
- download: current
displayName: "Download Artifact"
artifact: $(artifactName)
steps:
# Step 1: Install Firebase tools
- script: "npm install -g firebase-tools"
displayName: "Install Firebase Tools"

- download: current
displayName: "Download Release Notes"
artifact: $(releaseNotesArtifactName)
# Step 2: Download the service connection key file
- task: DownloadSecureFile@1
inputs:
secureFile: ${{ parameters.serviceConnectionKeyFileName }}
name: DistributionServiceConnection
displayName: "Download Firebase Service Connection"

- task: AppCenterDistribute@3
displayName: Deploy Android to AppCenter
inputs:
serverEndpoint: ${{ parameters.appCenterServiceConnectionName }}
distributionGroupId: ${{ parameters.appCenterDistributionGroup }}
appSlug: ${{ parameters.appCenterAndroidSlug }}
appFile: '$(Pipeline.Workspace)/$(artifactName)/*Signed.aab'
releaseNotesOption: file
releaseNotesFile: "$(Pipeline.Workspace)/$(releaseNotesArtifactName)/ReleaseNotes-Excerpt.md"
isSilent: true
# Step 3: Deploy to Firebase App Distribution
- script: |
echo "Deploying to Firebase App Distribution..."
echo "App ID: $(ApplicationIdentifier)"
echo "Path to AAB: $(pathToAab)"
firebase appdistribution:distribute $(pathToAab) \
--app $(ApplicationIdentifier) \
--groups nventive \
--debug
env:
GOOGLE_APPLICATION_CREDENTIALS: $(DistributionServiceConnection.secureFilePath)
displayName: "Deploy to Firebase"

- task: DeleteFiles@1
displayName: "Remove Downloaded Artifacts (Build)"
condition: always()
inputs:
SourceFolder: $(Pipeline.Workspace)/$(artifactName)
RemoveSourceFolder: true
Contents: '**'

- task: DeleteFiles@1
displayName: "Remove Downloaded Artifacts (Release Notes)"
condition: always()
inputs:
SourceFolder: $(Pipeline.Workspace)/$(releaseNotesArtifactName)
RemoveSourceFolder: true
Contents: '**'
# - deployment: AppCenter_iOS
# pool:
# vmImage: $(macOSHostedAgentImage)
# variables:
# - name: artifactName
# value: $(iOSArtifactName)_${{ parameters.applicationEnvironment }}
# - name: releaseNotesArtifactName
# value: ReleaseNotes_${{ parameters.applicationEnvironment }}
# environment: ${{ parameters.deploymentEnvironment }}
# strategy:
# runOnce:
# deploy:
# steps:
# - download: current
# displayName: "Download Artifact"
# artifact: $(artifactName)

- deployment: AppCenter_iOS
pool:
vmImage: $(macOSHostedAgentImage)
variables:
- name: artifactName
value: $(iOSArtifactName)_${{ parameters.applicationEnvironment }}
- name: releaseNotesArtifactName
value: ReleaseNotes_${{ parameters.applicationEnvironment }}
environment: ${{ parameters.deploymentEnvironment }}
strategy:
runOnce:
deploy:
steps:
- download: current
displayName: "Download Artifact"
artifact: $(artifactName)

- download: current
displayName: "Download Release Notes"
artifact: $(releaseNotesArtifactName)
# - download: current
# displayName: "Download Release Notes"
# artifact: $(releaseNotesArtifactName)

- task: AppCenterDistribute@3
displayName: Deploy iOS to AppCenter
inputs:
serverEndpoint: ${{ parameters.appCenterServiceConnectionName }}
appSlug: ${{ parameters.appCenteriOSSlug }}
appFile: $(Pipeline.Workspace)/$(artifactName)/*.ipa
symbolsDsymFiles: $(Pipeline.Workspace)/$(artifactName)/*.dSYM
symbolsIncludeParentDirectory: true
distributionGroupId: ${{ parameters.appCenterDistributionGroup }}
releaseNotesOption: file
releaseNotesFile: "$(Pipeline.Workspace)/$(releaseNotesArtifactName)/ReleaseNotes-Excerpt.md"
isSilent: true
# - task: AppCenterDistribute@3
# displayName: Deploy iOS to AppCenter
# inputs:
# serverEndpoint: ${{ parameters.appCenterServiceConnectionName }}
# appSlug: ${{ parameters.appCenteriOSSlug }}
# appFile: $(Pipeline.Workspace)/$(artifactName)/*.ipa
# symbolsDsymFiles: $(Pipeline.Workspace)/$(artifactName)/*.dSYM
# symbolsIncludeParentDirectory: true
# distributionGroupId: ${{ parameters.appCenterDistributionGroup }}
# releaseNotesOption: file
# releaseNotesFile: "$(Pipeline.Workspace)/$(releaseNotesArtifactName)/ReleaseNotes-Excerpt.md"
# isSilent: true

- task: DeleteFiles@1
displayName: "Remove Downloaded Artifacts (Build)"
condition: always()
inputs:
SourceFolder: $(Pipeline.Workspace)/$(artifactName)
RemoveSourceFolder: true
Contents: '**'
# - task: DeleteFiles@1
# displayName: "Remove Downloaded Artifacts (Build)"
# condition: always()
# inputs:
# SourceFolder: $(Pipeline.Workspace)/$(artifactName)
# RemoveSourceFolder: true
# Contents: '**'

- task: DeleteFiles@1
displayName: "Remove Downloaded Artifacts (Release Notes)"
condition: always()
inputs:
SourceFolder: $(Pipeline.Workspace)/$(releaseNotesArtifactName)
RemoveSourceFolder: true
Contents: '**'
# - task: DeleteFiles@1
# displayName: "Remove Downloaded Artifacts (Release Notes)"
# condition: always()
# inputs:
# SourceFolder: $(Pipeline.Workspace)/$(releaseNotesArtifactName)
# RemoveSourceFolder: true
# Contents: '**'
1 change: 1 addition & 0 deletions build/stage-release-firebase.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions build/variables.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
AppCenterServiceConnection: AppCenter-nventive-framework
AppStoreServiceConnection: AppStore-nventive
AppCenterCanaryServiceConnection: AppCenter-nventive-framework
FirebaseAppDistributionServiceConnection: com.nventive.applicationtemplate.firebaseappdistribution.json

# AppCenter slugs
# The "app slug" corresponds to the identifiers of the app in AppCenter; to find it, navigate to the app in a browser and;
Expand Down
11 changes: 7 additions & 4 deletions doc/AzurePipelines.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Azure Pipelines
# Azure Pipelines

## Pipeline Code
This project uses CI/CD pipelines that are implemented as yaml code.
Expand All @@ -18,7 +18,7 @@ These pipelines rely on a few variable groups and secrets in order to fully work

At high level, the CI/CD pipelines do the following:
- **Build** the app in **staging**.
- **Deploy** the staging app (to AppCenter and/or TestFlight and GooglePlay).
- **Deploy** the staging app (to Firebase app distribution and/or TestFlight and GooglePlay).
- **Build** the app in **production**.
- **Deploy** the production app (to TestFlight and GooglePlay).

Expand Down Expand Up @@ -69,7 +69,10 @@ This is where the exact build steps are defined. These vary depending on the pla
The release stages are even more straigtforward than the build ones. One thing to note is that, for the same reason as it is done at the end of the build steps, a clean-up step is included in every stage.

### AppCenter Release Stage ([stage-release-appcenter.yml](../build/stage-release-appcenter.yml))
This stage is in charge of pushing the application to AppCenter. It's divided into 2 jobs, one for each platform.
This stage is in charge of pushing the application to AppCenter. Only for iOS

### Firebase app distribution Release Stage ([stage-release-firebase.yml](../build/stage-release-firebase.yml))
This stage is in charge of pushing the application to Firebase app distribution. Only for android.

### Apple AppStore Release Stage ([stage-release-appstore.yml](../build/stage-release-appstore.yml))
This stage is in charge of pushing the iOS version to the Apple AppStore. Given that the build stage signs the application, this is as simple as using the proper task and pushing the **IPA** file. This should only be run for configurations that properly sign the application.
Expand Down Expand Up @@ -102,4 +105,4 @@ This pipelines creates a branch on which it commits a version of the latest code
### Canary Deployment
This pipelines triggers automatically when a new branch is created and pushed by the previous pipeline. It takes the new code, builds it, and deploys so that it can be manually tested.

This pipeline uses the same build and release stages as the main CI/CD pipeline of the app.
This pipeline uses the same build and release stages as the main CI/CD pipeline of the app.
Loading