Files
element-call-Github/embedded/android/publish_android_package.sh
Hugh Nimmo-Smith 7ca70cf4ab Publish embedded package for releases of Element Call (#3086)
* Publish embedded package for releases of Element Call

Part of https://github.com/element-hq/element-call/issues/2994

This PR:

- Publishes embedded builds as Tarball, NPM, AAR, SwiftPM for releases
- Publishes full builds as Tarball for releases
- Adds comments to release notes with the built artifact locations

* Update embedded/web/package.json

Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>

* Update .github/workflows/publish-embedded-packages.yaml

* Update embedded/ios/Package.swift

* Apply suggestions from code review

* Try dry-run of gradlew

* Whitespace

* Fix more instances of unpinned GHA

* Minimise permissions

* Upload release notes once

To reduce concurrency

* Fix npm publish permissions

---------

Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
2025-03-19 21:33:09 +00:00

59 lines
1.3 KiB
Bash
Executable File

#!/usr/bin/env bash
# This script is used for local build and testing of the AAR packaging
# In CI we call gradlew directly
EC_ASSETS_FOLDER=lib/src/main/assets/element-call
CURRENT_DIR=$( dirname -- "${BASH_SOURCE[0]}" )
pushd $CURRENT_DIR > /dev/null
function build_assets() {
echo "Generating Element Call assets..."
pushd ../.. > /dev/null
yarn build
popd > /dev/null
}
function copy_assets() {
if [ ! -d $EC_ASSETS_FOLDER ]; then
echo "Creating $EC_ASSETS_FOLDER..."
mkdir -p $EC_ASSETS_FOLDER
fi
echo "Copying generated Element Call assets to the Android project..."
cp -R ../../dist/* $EC_ASSETS_FOLDER
}
getopts :sh opt
case $opt in
s)
SKIP=1
;;
h)
echo "-s: will skip building the assets and just publish the library."
exit 0
;;
esac
if [ ! $SKIP ]; then
read -p "Do you want to re-build the assets (y/n, defaults to no)? " -n 1 -r
echo ""
if [[ $REPLY =~ ^[Yy]$ ]]; then
build_assets
else
echo "Using existing assets from ../../dist"
fi
copy_assets
elif [ ! -d $EC_ASSETS_FOLDER ]; then
echo "Assets folder at $EC_ASSETS_FOLDER not found. Either build and copy the assets manually or remove the -s flag."
exit 1
fi
# Exit with an error if the gradle publishing fails
set -e
echo "Publishing the Android project"
./gradlew publishAndReleaseToMavenCentral --no-daemon
popd > /dev/null