Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
185 changes: 181 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ on:
- 'macos-14-aarch64' # Build for MacOS 14 (Apple Silicon)
- 'macos-13-x86_64' # Build for MacOS 13 (Intel)
- 'windows-2022-x86_64' # Build for Windows 2022 x86_64
- 'android' # Build for Android (API 33+)
- 'ios' # Build for iOS (17.5+)
- 'ios-sim' # Build for iOS Simulator
release_tag:
description: 'Release tag (required if creating release)'
required: false
Expand Down Expand Up @@ -80,6 +83,7 @@ jobs:
needs: check_tag_version
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
mobile_matrix: ${{ steps.set-mobile-matrix.outputs.mobile_matrix }}
steps:
- name: Set build matrix
id: set-matrix
Expand Down Expand Up @@ -116,19 +120,51 @@ jobs:
"windows-2022-x86_64")
matrix='{"include":[{"os":"windows-2022","arch":"x86_64"}]}'
;;
*)
matrix='{"include":[]}' # No desktop builds for mobile-only options
;;
esac
else
matrix='{"include":[{"os":"ubuntu-24.04","arch":"x86_64"},{"os":"ubuntu-24.04-arm","arch":"aarch64"},{"os":"ubuntu-22.04","arch":"x86_64"},{"os":"ubuntu-22.04-arm","arch":"aarch64"},{"os":"macos-14","arch":"aarch64"},{"os":"macos-13","arch":"x86_64"},{"os":"windows-2022","arch":"x86_64"}]}'
fi
echo "matrix=$matrix" >> $GITHUB_OUTPUT

release_robrix_for_desktop:
name: Release Robrix for Desktop (${{ matrix.os }}, ${{ matrix.arch }})
- name: Set mobile matrix
id: set-mobile-matrix
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
case "${{ github.event.inputs.target_platforms }}" in
"All")
mobile_matrix='{"include":[{"os":"macos-14","platform":"android","target":"android"},{"os":"macos-14","platform":"ios","target":"ios"},{"os":"macos-14","platform":"ios-sim","target":"ios-sim"}]}'
;;
"android (API 33+)")
mobile_matrix='{"include":[{"os":"macos-14","platform":"android","target":"android"}]}'
;;
"ios (17.5+)")
mobile_matrix='{"include":[{"os":"macos-14","platform":"ios","target":"ios"}]}'
;;
"ios-sim (17.5+)")
mobile_matrix='{"include":[{"os":"macos-14","platform":"ios-sim","target":"ios-sim"}]}'
;;
*)
mobile_matrix='{"include":[]}' # No mobile builds for desktop-only options
;;
esac
else
mobile_matrix='{"include":[{"os":"macos-14","platform":"android","target":"android"},{"os":"macos-14","platform":"ios","target":"ios"},{"os":"macos-14","platform":"ios-sim","target":"ios-sim"}]}'
fi
echo "mobile_matrix=$mobile_matrix" >> $GITHUB_OUTPUT

build_robrix_for_desktop:
name: Build Robrix for Desktop (${{ matrix.os }}, ${{ matrix.arch }})
needs: determine_matrix
if: needs.determine_matrix.outputs.matrix != '{"include":[]}'
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.determine_matrix.outputs.matrix) }}
runs-on: ${{ matrix.os }}
outputs:
version: ${{ steps.set-version.outputs.version }}
steps:
- uses: actions/checkout@v4

Expand Down Expand Up @@ -167,6 +203,7 @@ jobs:
ls ./dist

- name: Set Version
id: set-version
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" && -n "${{ github.event.inputs.release_tag }}" ]]; then
VERSION="${{ github.event.inputs.release_tag }}"
Expand All @@ -175,6 +212,7 @@ jobs:
VERSION=$(cargo metadata --no-deps --format-version 1 --frozen | jq -r '.packages[0].version')
fi
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "version=$VERSION" >> $GITHUB_OUTPUT
shell: bash

- name: Set Artifact and Upload Paths
Expand All @@ -184,7 +222,6 @@ jobs:
OS=${{ matrix.os }}
ARCH=${{ matrix.arch }}


if [[ "$OS" == "ubuntu-22.04" || "$OS" == "ubuntu-24.04" ]]; then
{
echo "DEB=robrix_${VERSION}_amd64.deb"
Expand Down Expand Up @@ -248,4 +285,144 @@ jobs:
with:
name: robrix-${{ env.VERSION }}-${{ matrix.os }}-${{ matrix.arch }}
path: ${{ env.UPLOAD_FILES }}
retention-days: 30
retention-days: 30

build_robrix_for_mobile:
name: Build Robrix for Mobile (${{ matrix.platform }})
needs: determine_matrix
if: needs.determine_matrix.outputs.mobile_matrix != '{"include":[]}'
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.determine_matrix.outputs.mobile_matrix) }}
runs-on: ${{ matrix.os }}
outputs:
version: ${{ steps.set-version.outputs.version }}
steps:
- uses: actions/checkout@v4

- name: Install Rust Stable
uses: dtolnay/rust-toolchain@stable

- name: Install cargo-makepad
run: |
cargo install --force --git https://github.com/makepad/makepad.git --branch dev cargo-makepad

- name: Install toolchain
run: |
if [[ "${{ matrix.platform }}" == "android" ]]; then
cargo makepad android install-toolchain
elif [[ "${{ matrix.platform }}" == "ios" || "${{ matrix.platform }}" == "ios-sim" ]]; then
cargo makepad apple ios install-toolchain
else
echo "Unsupported platform: ${{ matrix.platform }}"
exit 1
fi

- name: Install the Apple certificate and provisioning profile
if: ${{ matrix.platform == 'ios' }}
env:
BUILD_CERTIFICATE_BASE64: ${{ secrets.IOS_BUILD_CERTIFICATE_BASE64 }}
P12_PASSWORD: ${{ secrets.IOS_P12_PASSWORD }}
BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.IOS_BUILD_PROVISION_PROFILE_BASE64 }}
KEYCHAIN_PASSWORD: ${{ secrets.IOS_KEYCHAIN_PASSWORD }}
run: |
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db

echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH
echo -n "$BUILD_PROVISION_PROFILE_BASE64" | base64 --decode -o $PP_PATH

security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH

security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
security set-key-partition-list -S apple-tool:,apple: -k "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security list-keychain -d user -s $KEYCHAIN_PATH

mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles

PROFILE_UUID=$(/usr/libexec/PlistBuddy -c "Print UUID" /dev/stdin <<< $(security cms -D -i $PP_PATH))
echo "PROFILE_PATH=$PROFILE_UUID" >> $GITHUB_ENV

CERT_FINGERPRINT=$(security find-certificate -c "Apple Distribution" -a -Z $KEYCHAIN_PATH | grep SHA-1 | head -n 1 | awk '{print $3}')
echo "CERT_FINGERPRINT=$CERT_FINGERPRINT" >> $GITHUB_ENV

- name: Build Mobile Artifacts
run: |
if [[ "${{ matrix.platform }}" == "android" ]]; then
cargo makepad android build -p robrix --release # makepad-android-apk/robrix/apk/robrix.apk
elif [[ "${{ matrix.platform }}" == "ios-sim" ]]; then
cargo makepad apple ios --org=org.robius --app=robrix run-sim -p robrix --release # makepad-apple-app/aarch64-apple-ios-sim/release/../.
elif [[ "${{ matrix.platform }}" == "ios" ]]; then
cargo makepad apple ios \
--org=org.robius \
--app=robrix \
--profile=$PROFILE_PATH \
--cert=$CERT_FINGERPRINT \
--device=IPhone \
run-device -p robrix --release # makepad-apple-app/aarch64-apple-ios/release/../.
else
echo "Unsupported platform: ${{ matrix.platform }}"
exit 1
fi

- name: Set Version
id: set-version
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" && -n "${{ github.event.inputs.release_tag }}" ]]; then
VERSION="${{ github.event.inputs.release_tag }}"
VERSION="${VERSION#v}" # Remove 'v' prefix if present
else
VERSION=$(cargo metadata --no-deps --format-version 1 --frozen | jq -r '.packages[0].version')
fi
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "version=$VERSION" >> $GITHUB_OUTPUT
shell: bash

- name: Set Artifact and Upload Paths
run: |
VERSION=${{ env.VERSION }}

if [[ "${{matrix.platform}}" == "ios-sim" ]]; then
cd ./target/makepad-apple-app/aarch64-apple-ios-sim/release
zip -r "robrix-${VERSION}-ios-sim.zip" .
echo "UPLOAD_FILES=./target/makepad-apple-app/aarch64-apple-ios-sim/release/robrix-${VERSION}-ios-sim.zip" >> $GITHUB_ENV
elif [[ "${{matrix.platform}}" == "ios" ]]; then
cd ./target/makepad-apple-app/aarch64-apple-ios/release
mkdir Payload
cp -r robrix.app Payload/
zip -r "robrix-${VERSION}-ios.ipa" Payload
echo "UPLOAD_FILES=./target/makepad-apple-app/aarch64-apple-ios/release/robrix-${VERSION}-ios.ipa" >> $GITHUB_ENV
elif [[ "${{matrix.platform}}" == "android" ]]; then
cd ./target/makepad-android-apk/robrix/apk
mv robrix.apk "robrix-${VERSION}.apk"
echo "UPLOAD_FILES=./target/makepad-android-apk/robrix/apk/robrix-${VERSION}.apk" >> $GITHUB_ENV
else
echo "Unsupported platform: ${{ matrix.platform }}"
exit 1
fi

- name: Upload Release Artifacts
if: |
(github.event_name == 'push') ||
(github.event_name == 'workflow_dispatch' && github.event.inputs.create_release == 'true')
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.release_tag || format('v{0}', env.VERSION) }}
name: ${{ github.event_name == 'workflow_dispatch' && format('Robrix {0}', github.event.inputs.release_tag) || format('Robrix v{0}', env.VERSION) }}
token: ${{ secrets.ROBRIX_RELEASE }}
files: ${{ env.UPLOAD_FILES }}
prerelease: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.pre_release == 'true' || contains(github.ref, '-') }}
draft: ${{ github.event_name == 'workflow_dispatch' }}

- name: Upload Artifacts (No Release)
if: |
github.event_name == 'workflow_dispatch' && github.event.inputs.create_release != 'true'
uses: actions/upload-artifact@v4
with:
name: robrix-${{ env.VERSION }}-${{ matrix.platform }}
path: ${{ env.UPLOAD_FILES }}
retention-days: 30
Loading