Skip to content

Commit

Permalink
Move upload to stores and release notes creation to separate Jenkinsfile
Browse files Browse the repository at this point in the history
Part of #6830

Co-authored-by: paw <[email protected]>
  • Loading branch information
hrb-hub and paw-hub committed Nov 13, 2024
1 parent 4d25b43 commit 1d2569a
Show file tree
Hide file tree
Showing 5 changed files with 305 additions and 130 deletions.
65 changes: 0 additions & 65 deletions ci/Android.Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ pipeline {
PATH = "${env.NODE_PATH}:${env.PATH}:/home/jenkins/emsdk/upstream/bin/:/home/jenkins/emsdk/:/home/jenkins/emsdk/upstream/emscripten"
ANDROID_SDK_ROOT = "/opt/android-sdk-linux"
ANDROID_HOME = "/opt/android-sdk-linux"
GITHUB_RELEASE_PAGE = "https://github.com/tutao/tutanota/releases/tag/tutanota-android-release-${VERSION}"
}

agent {
Expand All @@ -23,11 +22,6 @@ pipeline {
"Uploads both to Nexus and creates a new release on google play, " +
"which must be manually published from play.google.com/console"
)
persistentText(
name: "releaseNotes",
defaultValue: "",
description: "release notes for this build"
)
}

stages {
Expand Down Expand Up @@ -124,26 +118,6 @@ pipeline {
assetFilePath: "${WORKSPACE}/build/app-android/tutanota-app-tutao-releaseTest-${VERSION}.apk",
fileExtension: 'apk'
)

catchError(stageResult: 'UNSTABLE', buildResult: 'SUCCESS', message: 'Failed to upload android test app to Play Store') {
// This doesn't publish to the main app on play store,
// instead it gets published to the hidden "tutanota-test" app
// this happens because the AppId is set to de.tutao.tutanota.test by the android build
// and play store knows which app to publish just based on the id
androidApkUpload(
googleCredentialsId: 'android-app-publisher-credentials',
apkFilesPattern: "build/app-android/tutanota-app-tutao-releaseTest-${VERSION}.apk",
trackName: 'internal',
rolloutPercentage: '100%',
recentChangeList: [
[
language: "en-US",
text : "see: ${GITHUB_RELEASE_PAGE}"
]
]
) // androidApkUpload
} // catchError

}
}
} // stage testing
Expand All @@ -163,49 +137,10 @@ pipeline {
assetFilePath: "${WORKSPACE}/${filePath}",
fileExtension: 'apk'
)

androidApkUpload(
googleCredentialsId: 'android-app-publisher-credentials',
apkFilesPattern: "${filePath}",
trackName: 'production',
// Don't publish the app to users directly
// It will require manual intervention at play.google.com/console
rolloutPercentage: '0%',
recentChangeList: [
[
language: "en-US",
text : "see: ${GITHUB_RELEASE_PAGE}"
]
]
)
}
}
} // stage production
}
}
stage('Tag and publish release page') {
when {
expression { return params.RELEASE }
}
steps {
// Needed to upload it
unstash 'apk-production'

script {
def filePath = "build/app-android/tutanota-app-tutao-release-${VERSION}.apk"

writeFile file: "notes.txt", text: params.releaseNotes
catchError(stageResult: 'UNSTABLE', buildResult: 'SUCCESS', message: 'Failed to create github release page for android') {
withCredentials([string(credentialsId: 'github-access-token', variable: 'GITHUB_TOKEN')]) {
sh """node buildSrc/createReleaseDraft.js --name '${VERSION} (Android)' \
--tag 'tutanota-android-release-${VERSION}' \
--uploadFile '${WORKSPACE}/${filePath}' \
--notes notes.txt"""
} // withCredentials
} // catchError
sh "rm notes.txt"
} // script
}
}
}
}
57 changes: 0 additions & 57 deletions ci/Ios.Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ pipeline {
environment {
NODE_MAC_PATH = "/usr/local/opt/node@20/bin/"
VERSION = sh(returnStdout: true, script: "${env.NODE_PATH}/node -p -e \"require('./package.json').version\" | tr -d \"\n\"")
RELEASE_NOTES_PATH = "app-ios/fastlane/metadata/default/release_notes.txt"
}

agent {
Expand All @@ -24,11 +23,6 @@ pipeline {
name: 'STAGING',
defaultValue: true
)
persistentText(
name: "releaseNotes",
defaultValue: "",
description: "release notes for this build"
)
}

stages {
Expand Down Expand Up @@ -99,7 +93,6 @@ pipeline {
generateXCodeProjects()
util.runFastlane("de.tutao.tutanota", "adhoc_prod")
if (params.RELEASE) {
writeReleaseNotesForAppStore()
util.runFastlane("de.tutao.tutanota", "appstore_prod submit:true")
}
stash includes: "app-ios/releases/tutanota-${VERSION}-adhoc.ipa", name: 'ipa-production'
Expand Down Expand Up @@ -137,36 +130,6 @@ pipeline {
}
}
}

stage('Tag and create github release page') {
environment {
PATH = "${env.NODE_PATH}:${env.PATH}"
}
when {
expression { return params.RELEASE }
}
agent {
label 'linux'
}
steps {
script {

catchError(stageResult: 'UNSTABLE', buildResult: 'SUCCESS', message: 'Failed to create github release page for ios') {
def tag = "tutanota-ios-release-${VERSION}"
// need to run npm ci to install dependencies of releaseNotes.js
sh "npm ci"

writeFile file: "notes.txt", text: params.releaseNotes
withCredentials([string(credentialsId: 'github-access-token', variable: 'GITHUB_TOKEN')]) {
sh """node buildSrc/createReleaseDraft.js --name '${VERSION} (iOS)' \
--tag 'tutanota-ios-release-${VERSION}' \
--notes notes.txt"""
} // withCredentials
sh "rm notes.txt"
} // catchError
}
}
}
}
}

Expand Down Expand Up @@ -209,26 +172,6 @@ void generateCalendarProject() {
generateXCodeProject("app-ios", "calendar-project")
}


void writeReleaseNotesForAppStore() {
script {
catchError(stageResult: 'UNSTABLE', buildResult: 'SUCCESS', message: 'Failed to create github release notes for ios') {
// need to run npm ci to install dependencies of releaseNotes.js
sh "npm ci"
writeFile file: "notes.txt", text: params.releaseNotes
withCredentials([string(credentialsId: 'github-access-token', variable: 'GITHUB_TOKEN')]) {
sh """node buildSrc/createReleaseDraft.js --name '${VERSION} (iOS)' \
--tag 'tutanota-ios-release-${VERSION}'\
--notes notes.txt \
--toFile ${RELEASE_NOTES_PATH}"""
}
sh "rm notes.txt"
}
}

sh "echo Created release notes for fastlane ${RELEASE_NOTES_PATH}"
}

void publishToNexus(String artifactId, String ipaFileName) {
def util = load "ci/jenkins-lib/util.groovy"
util.publishToNexus(groupId: "app",
Expand Down
4 changes: 2 additions & 2 deletions ci/Publish-CalendarMobileArtifacts.Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,12 @@ pipeline {
}
steps {
script {
catchError(stageResult: 'UNSTABLE', buildResult: 'SUCCESS', message: 'Failed to upload android app to GitHub') {
catchError(stageResult: 'UNSTABLE', buildResult: 'SUCCESS', message: 'Failed to upload iOS app to GitHub') {
writeReleaseNotes("ios", "iOS", "${env.VERSION}", "")
}
} // script
} // steps
} // stage Android App
} // stage iOS App
}
}
stage("Publishing Artifacts to Stores") {
Expand Down
Loading

0 comments on commit 1d2569a

Please sign in to comment.