diff --git a/.github/workflows/beta.build-push.yml b/.github/workflows/beta.build-push.yml index c95b89b666..da2feffead 100644 --- a/.github/workflows/beta.build-push.yml +++ b/.github/workflows/beta.build-push.yml @@ -18,7 +18,7 @@ jobs: outputs: release-tag: ${{ steps.releasenotes.outputs.tag }} release-name: ${{ steps.releasenotes.outputs.name }} - release-changelog: ${{ steps.releasenotes.outputs.notes }} + release-notes: ${{ steps.releasenotes.outputs.notes }} env: APP_NAME: "Monal" APP_DIR: "Monal.app" @@ -65,26 +65,34 @@ 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 "OUTPUT_FILE=$OUTPUT_FILE" | tee /dev/stderr >> "$GITHUB_OUTPUT" - echo "tag=Build_iOS_$buildNumber" | tee /dev/stderr >> "$GITHUB_OUTPUT" + 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 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 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 >> "$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 +109,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 @@ -183,5 +191,5 @@ jobs: recipient_is_room: true bot_alias: "Monal Release Bot" message: | - New Betarelease: ${{ needs.buildAndPublishBeta.outputs.release-name }} - ${{ needs.buildAndPublishBeta.outputs.release-changelog }} + ${{ needs.buildAndPublishBeta.outputs.release-name }} was released + ${{ needs.buildAndPublishBeta.outputs.release-notes }} diff --git a/.github/workflows/publish-stable-release.yml b/.github/workflows/publish-stable-release.yml new file mode 100644 index 0000000000..808aea07b0 --- /dev/null +++ b/.github/workflows/publish-stable-release.yml @@ -0,0 +1,96 @@ +name: Publish release +on: + repository_dispatch: + types: [distribution] +jobs: + extractChangelog: + runs-on: self-hosted + outputs: + release-buildNumber: ${{ steps.releasenotes.outputs.buildNumber }} + release-tag: ${{ steps.releasenotes.outputs.tag }} + release-version: ${{ steps.releasenotes.outputs.version }} + release-name: ${{ steps.releasenotes.outputs.name }} + release-notes: ${{ steps.releasenotes.outputs.notes }} + release-notes_ios: ${{ steps.releasenotes.outputs.notes_ios }} + release-notes_macos: ${{ steps.releasenotes.outputs.notes_macos }} + # 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: + # - run: | + # echo ${{ github.event.client_payload.AppName }} + # echo ${{ github.event.client_payload.Platform }} + # echo ${{ github.event.client_payload.AppVersionNumber }} + - 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" + + PromoteDraftRelease: + name: Promote draft release to live release + runs-on: ubuntu-latest + needs: [extractChangelog] + steps: + - name: Promote draft release to live release + run: | + echo "ID: ${{ steps.releasenotes.outputs.releaseID }}" + curl -L \ + -X PATCH \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + "https://api.github.com/repos/${{ github.repository }}/releases/${{ steps.draftrelease.outputs.id }}" \ + -d '{"draft": false, "prerelease": false, "make_latest": true}' + + # notifyMuc: + # name: Notify support MUC about new stable release + # runs-on: ubuntu-latest + # needs: [extractChangelog] + # steps: + # - name: Notify support MUC + # uses: monal-im/xmpp-notifier@master + # with: # Set the secrets as inputs + # jid: ${{ secrets.BOT_JID }} + # password: ${{ secrets.BOT_PASSWORD }} + # server_host: ${{ secrets.BOT_SERVER }} + # recipient: monal@chat.yax.im + # recipient_is_room: true + # bot_alias: "Monal Release Bot" + # message: | + # ${{ needs.extractChangelog.outputs.release-name }} was released: + # ${{ needs.extractChangelog.outputs.release-notes }} + + notifyMastodon: + name: Post release info on mastodon + runs-on: ubuntu-latest + needs: [extractChangelog] + steps: + - name: Patch changelog length + id: changelog + env: + NOTES: ${{ needs.extractChangelog.outputs.release-notes }} + run: | + if [ "${#NOTES}" -gt 400 ]; then + NOTES="To see the complete list of bugfixes and improvements, check our releases page: https://github.com/monal-im/Monal/releases/tag/${{ needs.extractChangelog.outputs.release-tag }}" + fi + echo "notes<<__EOF__" | tee /dev/stderr >> "$GITHUB_OUTPUT" + echo "$NOTES" >> "$GITHUB_OUTPUT" + echo "__EOF__" | tee /dev/stderr >> "$GITHUB_OUTPUT" + - name: Post release info on mastodon + id: toot + uses: cbrgm/mastodon-github-action@v2.1.3 + with: + access-token: ${{ secrets.MASTODON_ACCESS_TOKEN }} + url: ${{ secrets.MASTODON_URL }} + + message: "${{ needs.extractChangelog.outputs.release-name }} released.\n\n${{ steps.changelog.outputs.notes }}\n\n#xmpp #ios #macos" + visibility: "public" + language: "en" + - name: Get toot information + run: | + echo "Toot ID: ${{ steps.toot.outputs.id }}" + echo "Toot URL: ${{ steps.toot.outputs.url }}" + echo "Scheduled at: ${{ steps.toot.outputs.scheduled_at }}" diff --git a/.github/workflows/stable.build-push.yml b/.github/workflows/stable.build-push.yml index b3fae8ea6f..c28ba1143c 100644 --- a/.github/workflows/stable.build-push.yml +++ b/.github/workflows/stable.build-push.yml @@ -58,8 +58,48 @@ 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 "OUTPUT_FILE=$OUTPUT_FILE" | tee /dev/stderr >> "$GITHUB_OUTPUT" + + 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 +109,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 +147,8 @@ 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 + id: draftrelease uses: softprops/action-gh-release@v2 with: name: "${{ steps.releasenotes.outputs.name }}" @@ -123,5 +162,8 @@ jobs: ./Monal/build/app/Monal.zip fail_on_unmatched_files: true token: ${{ secrets.GITHUB_TOKEN }} - draft: false prerelease: false + draft: true + - name: Write draft release id to build env + run: | + echo "releaseID=${{ steps.draftrelease.outputs.id }}" | tee /dev/stderr >> "${{ steps.releasenotes.outputs.OUTPUT_FILE }}"