Skip to content

6.4.1 (#1132)

6.4.1 (#1132) #38

# build a new stable release and push it to apple
name: stable.build-push
# Controls when the action will run.
on:
# Triggers the workflow on push
push:
branches: [ stable ]
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
buildAndPublishStable:
# The type of runner that the job will run on
runs-on: self-hosted
env:
APP_NAME: "Monal"
BUILD_SCHEME: "Monal"
APP_DIR: "Monal.app"
BUILD_TYPE: "AppStore"
EXPORT_OPTIONS_CATALYST_APPSTORE: "../scripts/exportOptions/Stable_Catalyst_ExportOptions.plist"
EXPORT_OPTIONS_CATALYST_APP_EXPORT: "../scripts/exportOptions/Beta_Catalyst_ExportOptions.plist"
EXPORT_OPTIONS_IOS: "../scripts/exportOptions/Stable_iOS_ExportOptions.plist"
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/checkout@v4
with:
clean: true
submodules: true
fetch-depth: 100
fetch-tags: true
show-progress: true
lfs: true
- name: Checkout submodules
run: git submodule update -f --init --remote
- name: Get last build tag and increment it
run: |
oldBuildNumber=$(git tag --sort="v:refname" |grep "Build_iOS" | tail -n1 | sed 's/Build_iOS_//g')
buildNumber=$(expr $oldBuildNumber + 1)
echo "New buildNumber is $buildNumber"
git tag Build_iOS_$buildNumber
- name: Extract version number and changelog from newest merge commit
id: releasenotes
run: |
function repairNotes {
sed 's/\r//g' | awk '{
if (NR == 1) {
printf("%s", $0)
} else {
if ($0 ~ /^[\t ]*(-|IOS_ONLY[\t ]*-|MACOS_ONLY[\t ]*-).*$/) {
printf("\n%s", $0)
} else {
printf(" %s", $0)
}
}
}
END {
printf("\n")
}'
}
buildNumber="$(git tag --sort="v:refname" | grep "Build_iOS" | tail -n1 | sed 's/Build_iOS_//g')"
version="$(git log -n 1 --merges --pretty=format:%s | sed -E 's/^[\t\n ]*([^\n\t ]+)[\t\n ]+\(([^\n\t ]+)\)[\t\n ]*$/\1/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=$version" | tee /dev/stderr >> "$OUTPUT_FILE"
echo "buildVersion=$(echo "$version" | grep -oE '^[0-9]+(\.[0-9]+){0,2}')" | 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)" | repairNotes | sed -E 's/^[\t\n ]*IOS_ONLY[\t\n ]?(.*)$/\1/g' | sed -E 's/^[\t\n ]*MACOS_ONLY[\t\n ]?(.*)$/\1/g' | 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)" | repairNotes | grep -v '^[\t\n ]*MACOS_ONLY.*$' | sed -E 's/^[\t\n ]*IOS_ONLY[\t\n ]?(.*)$/\1/g' | 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)" | repairNotes | grep -v '^[\t\n ]*IOS_ONLY.*$' | sed -E 's/^[\t\n ]*MACOS_ONLY[\t\n ]?(.*)$/\1/g' | tee /dev/stderr >> "$OUTPUT_FILE"
echo "__EOF__" | tee /dev/stderr >> "$OUTPUT_FILE"
cat "$OUTPUT_FILE" >> "$GITHUB_OUTPUT"
- name: Insert buildNumber and version into plists
env:
buildNumber: ${{ steps.releasenotes.outputs.buildNumber }}
buildVersion: ${{ steps.releasenotes.outputs.buildVersion }}
run: sh ./scripts/set_version_number.sh
- name: Import TURN secrets
run: |
if [[ -e "/Users/ci/secrets.monal_stable" ]]; then
echo "#import \"/Users/ci/secrets.monal_stable\"" > Monal/Classes/secrets.h
fi
- name: Make our build scripts executable
run: chmod +x ./scripts/build.sh
- name: Run build
run: ./scripts/build.sh
- uses: actions/upload-artifact@v4
with:
name: monal-ios
path: Monal/build/ipa/Monal.ipa
if-no-files-found: error
# - uses: actions/upload-artifact@v4
# with:
# name: monal-catalyst-dsym
# path: Monal/build/macos_Monal.xcarchive/dSYMs
# if-no-files-found: error
# - uses: actions/upload-artifact@v4
# with:
# name: monal-ios-dsym
# path: Monal/build/ios_Monal.xcarchive/dSYMs
# if-no-files-found: error
- name: validate ios app
run: xcrun altool --validate-app --file ./Monal/build/ipa/Monal.ipa --type ios -u $(cat /Users/ci/apple_connect_upload_mail.txt) -p "$(cat /Users/ci/apple_connect_upload_secret.txt)"
- name: push tag to stable repo
run: |
buildNumber=$(git tag --sort="v:refname" |grep "Build_iOS" | tail -n1 | sed 's/Build_iOS_//g')
git push origin Build_iOS_$buildNumber
- name: Create fastlane metadata directory
id: metadata
env:
CHANGELOG_IOS: ${{ steps.releasenotes.outputs.notes_ios }}
CHANGELOG_MACOS: ${{ steps.releasenotes.outputs.notes_macos }}
run: |
path_ios="$(mktemp -d)"
echo -n "$CHANGELOG_IOS" > "$path_ios/release_notes.txt"
echo "path_ios=$path_ios" | tee /dev/stderr >> "$GITHUB_OUTPUT"
path_macos="$(mktemp -d)"
echo -n "$CHANGELOG_MACOS" > "$path_macos/release_notes.txt"
echo "path_macos=$path_macos" | 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)"
env:
DELIVER_METADATA_PATH: ${{ steps.metadata.outputs.path_ios }}
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
run: |
cd Monal/build/app/tar_release/
xcrun stapler staple "$APP_DIR"
stapler validate "$APP_DIR"
/usr/bin/ditto -c -k --sequesterRsrc --keepParent "$APP_DIR" "../$APP_NAME.zip"
cd ../../../..
- uses: actions/upload-artifact@v4
with:
name: monal-catalyst-zip
path: Monal/build/app/Monal.zip
if-no-files-found: error
- uses: actions/upload-artifact@v4
with:
name: monal-catalyst-pkg
path: Monal/build/app/Monal.pkg
if-no-files-found: error
- 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
env:
DELIVER_METADATA_PATH: ${{ steps.metadata.outputs.path_macos }}
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 precheck:true precheck_include_in_app_purchases:false
# - 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_ios }}"
rm -rf "${{ steps.metadata.outputs.path_macos }}"
- name: Create Draft Release
id: draftrelease
uses: softprops/action-gh-release@v2
with:
name: "${{ steps.releasenotes.outputs.name }}"
tag_name: "${{ steps.releasenotes.outputs.tag }}"
target_commitish: stable
generate_release_notes: false
body: "${{ steps.releasenotes.outputs.notes }}"
files: |
./Monal/build/ipa/Monal.ipa
./Monal/build/app/Monal.pkg
./Monal/build/app/Monal.zip
fail_on_unmatched_files: true
token: ${{ secrets.GITHUB_TOKEN }}
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 }}"