From 62842dfe8e41581cfb9945ea7e5625e6711b8146 Mon Sep 17 00:00:00 2001 From: Thilo Molitor Date: Thu, 4 Jul 2024 03:04:24 +0200 Subject: [PATCH] Use fastlane for stable releases, too This uses our new mail2webhook python script installed on the mailserver to trigger a workflow posting release information once the iOS build reaches the appstore. --- .github/workflows/beta.build-push.yml | 32 ++++++---- .github/workflows/publish-stable-release.yml | 30 +++++++++ .github/workflows/stable.build-push.yml | 65 +++++++++++++++----- 3 files changed, 100 insertions(+), 27 deletions(-) create mode 100644 .github/workflows/publish-stable-release.yml diff --git a/.github/workflows/beta.build-push.yml b/.github/workflows/beta.build-push.yml index c95b89b666..c77e599ba9 100644 --- a/.github/workflows/beta.build-push.yml +++ b/.github/workflows/beta.build-push.yml @@ -65,26 +65,32 @@ jobs: id: releasenotes run: | buildNumber=$(git tag --sort="v:refname" | grep "Build_iOS" | tail -n1 | sed 's/Build_iOS_//g') + mkdir -p /Users/ci/releases + OUTPUT_FILE="/Users/ci/releases/$buildNumber.output" + touch "$OUTPUT_FILE" - echo "tag=Build_iOS_$buildNumber" | tee /dev/stderr >> "$GITHUB_OUTPUT" + echo "tag=Build_iOS_$buildNumber" | tee /dev/stderr >> "$OUTPUT_FILE" + echo "version=$(git log -n 1 --merges --pretty=format:%s | sed -E 's/^[\t\n ]*([^\n\t ]+)[\t\n ]+\(([^\n\t ]+)\)[\t\n ]*$/\1/g')" | tee /dev/stderr >> "$OUTPUT_FILE" - echo "name=Monal Beta $(git log -n 1 --merges --pretty=format:%s | sed -E 's/^[\t\n ]*([^\n\t ]+)[\t\n ]+\(([^\n\t ]+)\)[\t\n ]*$/\1 (Build '$buildNumber', PR \2)/g')" | tee /dev/stderr >> "$GITHUB_OUTPUT" + echo "name=Monal $(git log -n 1 --merges --pretty=format:%s | sed -E 's/^[\t\n ]*([^\n\t ]+)[\t\n ]+\(([^\n\t ]+)\)[\t\n ]*$/\1 (Build '$buildNumber', PR \2)/g')" | tee /dev/stderr >> "$OUTPUT_FILE" - echo "notes<<__EOF__" | tee /dev/stderr >> "$GITHUB_OUTPUT" - echo "$(git log -n 1 --merges --pretty=format:%b)" | sed -E 's/^[\t\n ]*IOS_ONLY[\t\n ]*(.*)$/\1' | sed -E 's/^[\t\n ]*MACOS_ONLY[\t\n ]*(.*)$/\1' | tee /dev/stderr >> "$GITHUB_OUTPUT" - echo "__EOF__" | tee /dev/stderr >> "$GITHUB_OUTPUT" + echo "notes<<__EOF__" | tee /dev/stderr >> "$OUTPUT_FILE" + echo "$(git log -n 1 --merges --pretty=format:%b)" | sed -E 's/^[\t\n ]*IOS_ONLY[\t\n ]*(.*)$/\1' | sed -E 's/^[\t\n ]*MACOS_ONLY[\t\n ]*(.*)$/\1' | tee /dev/stderr >> "$OUTPUT_FILE" + echo "__EOF__" | tee /dev/stderr >> "$OUTPUT_FILE" - echo "notes_ios<<__EOF__" | tee /dev/stderr >> "$GITHUB_OUTPUT" - echo "$(git log -n 1 --merges --pretty=format:%b)" | grep -v '^[\t\n ]*MACOS_ONLY.*$' | sed -E 's/^[\t\n ]*IOS_ONLY[\t\n ]*(.*)$/\1' | tee /dev/stderr >> "$GITHUB_OUTPUT" - echo "__EOF__" | tee /dev/stderr >> "$GITHUB_OUTPUT" + echo "notes_ios<<__EOF__" | tee /dev/stderr >> "$OUTPUT_FILE" + echo "$(git log -n 1 --merges --pretty=format:%b)" | grep -v '^[\t\n ]*MACOS_ONLY.*$' | sed -E 's/^[\t\n ]*IOS_ONLY[\t\n ]*(.*)$/\1' | tee /dev/stderr >> "$OUTPUT_FILE" + echo "__EOF__" | tee /dev/stderr >> "$OUTPUT_FILE" - echo "notes_macos<<__EOF__" | tee /dev/stderr >> "$GITHUB_OUTPUT" - echo "$(git log -n 1 --merges --pretty=format:%b)" | grep -v '^[\t\n ]*IOS_ONLY.*$' | sed -E 's/^[\t\n ]*MACOS_ONLY[\t\n ]*(.*)$/\1' | tee /dev/stderr >> "$GITHUB_OUTPUT" - echo "__EOF__" | tee /dev/stderr >> "$GITHUB_OUTPUT" + echo "notes_macos<<__EOF__" | tee /dev/stderr >> "$OUTPUT_FILE" + echo "$(git log -n 1 --merges --pretty=format:%b)" | grep -v '^[\t\n ]*IOS_ONLY.*$' | sed -E 's/^[\t\n ]*MACOS_ONLY[\t\n ]*(.*)$/\1' | tee /dev/stderr >> "$OUTPUT_FILE" + echo "__EOF__" | tee /dev/stderr >> "$OUTPUT_FILE" + + cat "$OUTPUT_FILE" >> "$GITHUB_OUTPUT" - name: Publish ios to appstore connect #run: xcrun altool --upload-app -f ./Monal/build/ipa/Monal.ipa --type ios --asc-provider S8D843U34Y --team-id S8D843U34Y -u "$(cat /Users/ci/apple_connect_upload_mail.txt)" -p "$(cat /Users/ci/apple_connect_upload_secret.txt)" env: - PILOT_CHANGELOG: ${{ steps.releasenotes.outputs.notes }} + PILOT_CHANGELOG: ${{ steps.releasenotes.outputs.notes_ios }} run: | fastlane run upload_to_testflight api_key_path:"/Users/ci/appstoreconnect/key.json" team_id:"S8D843U34Y" ipa:"./Monal/build/ipa/Monal.ipa" distribute_external:true groups:"Internal Pre-Beta Testers","Public Beta" reject_build_waiting_for_review:true submit_beta_review:true - name: Notarize catalyst @@ -101,7 +107,7 @@ jobs: - name: Publish catalyst to appstore connect #run: xcrun altool --upload-app --file ./Monal/build/app/Monal.pkg --type macos --asc-provider S8D843U34Y -u "$(cat /Users/ci/apple_connect_upload_mail.txt)" -p "$(cat /Users/ci/apple_connect_upload_secret.txt)" --primary-bundle-id org.monal-im.prod.catalyst.monal env: - PILOT_CHANGELOG: ${{ steps.releasenotes.outputs.notes }} + PILOT_CHANGELOG: ${{ steps.releasenotes.outputs.notes_macos }} run: | fastlane run upload_to_testflight api_key_path:"/Users/ci/appstoreconnect/key.json" team_id:"S8D843U34Y" pkg:"./Monal/build/app/Monal.pkg" distribute_external:true groups:"Internal Pre-Beta Testers","Public Beta" reject_build_waiting_for_review:true submit_beta_review:true - uses: actions/upload-artifact@v4 diff --git a/.github/workflows/publish-stable-release.yml b/.github/workflows/publish-stable-release.yml new file mode 100644 index 0000000000..693ee65432 --- /dev/null +++ b/.github/workflows/publish-stable-release.yml @@ -0,0 +1,30 @@ +name: Publish release +on: + repository_dispatch: + types: [distribution] +jobs: + extractChangelog: + runs-on: self-hosted + # create release only if the ios app made it to the appstore and ignore the macos appstore state + if: github.event.client_payload.Platform == 'iOS' + steps: + - name: Load release info + id: releasenotes + run: | + buildNumber="$(fastlane run app_store_build_number api_key_path:"/Users/ci/appstoreconnect/key.json" team_id:"S8D843U34Y" app_identifier:"G7YU7X7KRJ.SworIM" live:false version:"${{ github.event.client_payload.AppVersionNumber }}" 2>&1 | tee /dev/stderr | grep Result | sed -E 's/^.*Result: ([0-9]+).*$/\1/g')" + mkdir -p /Users/ci/releases + OUTPUT_FILE="/Users/ci/releases/$buildNumber.output" + touch "$OUTPUT_FILE" + cat "$OUTPUT_FILE" >> "$GITHUB_OUTPUT" + # - run: | + # echo ${{ github.event.client_payload.AppName }} + # echo ${{ github.event.client_payload.Platform }} + # echo ${{ github.event.client_payload.AppVersionNumber }} + - name: Promote draft release to live release + uses: softprops/action-gh-release@v2 + with: + tag_name: "${{ steps.releasenotes.outputs.tag }}" + target_commitish: stable + token: ${{ secrets.GITHUB_TOKEN }} + draft: false + make_latest: true \ No newline at end of file diff --git a/.github/workflows/stable.build-push.yml b/.github/workflows/stable.build-push.yml index b3fae8ea6f..66423c5194 100644 --- a/.github/workflows/stable.build-push.yml +++ b/.github/workflows/stable.build-push.yml @@ -58,8 +58,47 @@ jobs: run: | buildNumber=$(git tag --sort="v:refname" |grep "Build_iOS" | tail -n1 | sed 's/Build_iOS_//g') git push origin Build_iOS_$buildNumber + - name: Extract version number and changelog from newest merge commit + id: releasenotes + run: | + buildNumber=$(git tag --sort="v:refname" | grep "Build_iOS" | tail -n1 | sed 's/Build_iOS_//g') + mkdir -p /Users/ci/releases + OUTPUT_FILE="/Users/ci/releases/$buildNumber.output" + touch "$OUTPUT_FILE" + + echo "buildNumber=$buildNumber" | tee /dev/stderr >> "$OUTPUT_FILE" + echo "tag=Build_iOS_$buildNumber" | tee /dev/stderr >> "$OUTPUT_FILE" + echo "version=$(git log -n 1 --merges --pretty=format:%s | sed -E 's/^[\t\n ]*([^\n\t ]+)[\t\n ]+\(([^\n\t ]+)\)[\t\n ]*$/\1/g')" | tee /dev/stderr >> "$OUTPUT_FILE" + + echo "name=Monal $(git log -n 1 --merges --pretty=format:%s | sed -E 's/^[\t\n ]*([^\n\t ]+)[\t\n ]+\(([^\n\t ]+)\)[\t\n ]*$/\1 (Build '$buildNumber', PR \2)/g')" | tee /dev/stderr >> "$OUTPUT_FILE" + + echo "notes<<__EOF__" | tee /dev/stderr >> "$OUTPUT_FILE" + echo "$(git log -n 1 --merges --pretty=format:%b)" | sed -E 's/^[\t\n ]*IOS_ONLY[\t\n ]*(.*)$/\1' | sed -E 's/^[\t\n ]*MACOS_ONLY[\t\n ]*(.*)$/\1' | tee /dev/stderr >> "$OUTPUT_FILE" + echo "__EOF__" | tee /dev/stderr >> "$OUTPUT_FILE" + + echo "notes_ios<<__EOF__" | tee /dev/stderr >> "$OUTPUT_FILE" + echo "$(git log -n 1 --merges --pretty=format:%b)" | grep -v '^[\t\n ]*MACOS_ONLY.*$' | sed -E 's/^[\t\n ]*IOS_ONLY[\t\n ]*(.*)$/\1' | tee /dev/stderr >> "$OUTPUT_FILE" + echo "__EOF__" | tee /dev/stderr >> "$OUTPUT_FILE" + + echo "notes_macos<<__EOF__" | tee /dev/stderr >> "$OUTPUT_FILE" + echo "$(git log -n 1 --merges --pretty=format:%b)" | grep -v '^[\t\n ]*IOS_ONLY.*$' | sed -E 's/^[\t\n ]*MACOS_ONLY[\t\n ]*(.*)$/\1' | tee /dev/stderr >> "$OUTPUT_FILE" + echo "__EOF__" | tee /dev/stderr >> "$OUTPUT_FILE" + + cat "$OUTPUT_FILE" >> "$GITHUB_OUTPUT" + - name: Create fastlane metadata directory + id: metadata + env: + CHANGELOG: ${{ steps.releasenotes.outputs.notes_ios }} + run: | + path="$(mktemp -d)" + echo -n "$CHANGELOG" > "$path/release_notes.txt" + echo "path=$path" | tee /dev/stderr >> "$GITHUB_OUTPUT" - name: Publish ios to appstore connect - run: xcrun altool --upload-app --file ./Monal/build/ipa/Monal.ipa --type ios --asc-provider S8D843U34Y --team-id S8D843U34Y -u $(cat /Users/ci/apple_connect_upload_mail.txt) -p "$(cat /Users/ci/apple_connect_upload_secret.txt)" + #run: xcrun altool --upload-app --file ./Monal/build/ipa/Monal.ipa --type ios --asc-provider S8D843U34Y --team-id S8D843U34Y -u $(cat /Users/ci/apple_connect_upload_mail.txt) -p "$(cat /Users/ci/apple_connect_upload_secret.txt)" + env: + DELIVER_METADATA_PATH: ${{ steps.metadata.outputs.path }} + run: | + fastlane run upload_to_app_store api_key_path:"/Users/ci/appstoreconnect/key.json" team_id:"S8D843U34Y" ipa:"./Monal/build/ipa/Monal.ipa" app_version:"${{ steps.releasenotes.outputs.version }}" reject_if_possible:true submit_for_review:true automatic_release:true skip_metadata: true skip_screenshots: true - name: Notarize catalyst run: xcrun notarytool submit ./Monal/build/app/Monal.zip --wait --team-id S8D843U34Y --key "/Users/ci/appstoreconnect/apiKey.p8" --key-id "$(cat /Users/ci/appstoreconnect/apiKeyId.txt)" --issuer "$(cat /Users/ci/appstoreconnect/apiIssuerId.txt)" - name: staple @@ -69,12 +108,19 @@ jobs: stapler validate "$APP_DIR" /usr/bin/ditto -c -k --sequesterRsrc --keepParent "$APP_DIR" "../$APP_NAME.zip" cd ../../../.. - - name: upload new catalyst stable to monal-im.org + - name: Upload new catalyst stable to monal-im.org run: ./scripts/uploadNonAlpha.sh stable - name: Publish catalyst to appstore connect - run: xcrun altool --upload-app --file ./Monal/build/app/Monal.pkg --type macos --asc-provider S8D843U34Y -u "$(cat /Users/ci/apple_connect_upload_mail.txt)" -p "$(cat /Users/ci/apple_connect_upload_secret.txt)" --primary-bundle-id maccatalyst.G7YU7X7KRJ.SworIM + #run: xcrun altool --upload-app --file ./Monal/build/app/Monal.pkg --type macos --asc-provider S8D843U34Y -u "$(cat /Users/ci/apple_connect_upload_mail.txt)" -p "$(cat /Users/ci/apple_connect_upload_secret.txt)" --primary-bundle-id maccatalyst.G7YU7X7KRJ.SworIM + env: + DELIVER_METADATA_PATH: ${{ steps.metadata.outputs.path }} + run: | + fastlane run upload_to_app_store api_key_path:"/Users/ci/appstoreconnect/key.json" team_id:"S8D843U34Y" pkg:"./Monal/build/app/Monal.pkg" app_version:"${{ steps.releasenotes.outputs.version }}" reject_if_possible:true submit_for_review:true automatic_release:true skip_metadata: true skip_screenshots: true # - name: Update xmpp.org client list with new timestamp # run: ./scripts/push_xmpp.org.sh + - name: Remove fastlane metadata directory + run: | + rm -rf "${{ steps.metadata.outputs.path }}" - uses: actions/upload-artifact@v4 with: name: monal-catalyst-zip @@ -100,16 +146,7 @@ jobs: # name: monal-ios-dsym # path: Monal/build/ios_Monal.xcarchive/dSYMs # if-no-files-found: error - - name: Extract version number and changelog from newest merge commit - id: releasenotes - run: | - buildNumber=$(git tag --sort="v:refname" | grep "Build_iOS" | tail -n1 | sed 's/Build_iOS_//g') - echo "tag=Build_iOS_$buildNumber" | tee /dev/stderr >> "$GITHUB_OUTPUT" - echo "name=Monal $(git log -n 1 --merges --pretty=format:%s | sed -E 's/^[\t\n ]*([^\n\t ]+)[\t\n ]+\(([^\n\t ]+)\)[\t\n ]*$/\1 (Build '$buildNumber', PR \2)/g')" | tee /dev/stderr >> "$GITHUB_OUTPUT" - echo "notes<<__EOF__" | tee /dev/stderr >> "$GITHUB_OUTPUT" - echo "$(git log -n 1 --merges --pretty=format:%b)" | tee /dev/stderr >> "$GITHUB_OUTPUT" - echo "__EOF__" | tee /dev/stderr >> "$GITHUB_OUTPUT" - - name: Release + - name: Create Draft Release uses: softprops/action-gh-release@v2 with: name: "${{ steps.releasenotes.outputs.name }}" @@ -123,5 +160,5 @@ jobs: ./Monal/build/app/Monal.zip fail_on_unmatched_files: true token: ${{ secrets.GITHUB_TOKEN }} - draft: false prerelease: false + draft: true