Skip to content

Commit

Permalink
Use fastlane for stable releases, too
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
tmolitor-stud-tu committed Jul 4, 2024
1 parent 7833bc2 commit 4cde633
Show file tree
Hide file tree
Showing 3 changed files with 161 additions and 29 deletions.
36 changes: 21 additions & 15 deletions .github/workflows/beta.build-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -184,4 +190,4 @@ jobs:
bot_alias: "Monal Release Bot"
message: |
New Betarelease: ${{ needs.buildAndPublishBeta.outputs.release-name }}
${{ needs.buildAndPublishBeta.outputs.release-changelog }}
${{ needs.buildAndPublishBeta.outputs.release-notes }}
84 changes: 84 additions & 0 deletions .github/workflows/publish-stable-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
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: [email protected]
recipient_is_room: true
bot_alias: "Monal Release Bot"
message: |
New stable release: ${{ needs.extractChangelog.outputs.release-name }}
${{ needs.extractChangelog.outputs.release-notes }}
notifyMastodon:
name: Post release info on mastodon
runs-on: ubuntu-latest
needs: [extractChangelog]
steps:
- name: Post release info on mastodon
id: toot
uses: cbrgm/[email protected]
with:
access-token: ${{ secrets.MASTODON_ACCESS_TOKEN }}
url: ${{ secrets.MASTODON_URL }}
message: "${{ needs.extractChangelog.outputs.release-name }} released.\n\n${{ needs.extractChangelog.outputs.release-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 }}"
70 changes: 56 additions & 14 deletions .github/workflows/stable.build-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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 }}"
Expand All @@ -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 }}"

0 comments on commit 4cde633

Please sign in to comment.