mirror of
https://github.com/vector-im/element-call.git
synced 2026-07-09 18:29:21 +00:00
Add publishing flows and script
This commit is contained in:
19
.github/workflows/publish.yaml
vendored
19
.github/workflows/publish.yaml
vendored
@@ -63,3 +63,22 @@ jobs:
|
|||||||
docker_tags: |
|
docker_tags: |
|
||||||
type=sha,format=short,event=branch
|
type=sha,format=short,event=branch
|
||||||
type=semver,pattern=v{{version}}
|
type=semver,pattern=v{{version}}
|
||||||
|
publish_android:
|
||||||
|
needs: build_element_call
|
||||||
|
if: always()
|
||||||
|
name: Publish Android AAR
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: 📥 Download artifact
|
||||||
|
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4
|
||||||
|
with:
|
||||||
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
run-id: ${{ github.event.workflow_run.id || github.run_id }}
|
||||||
|
name: build-output
|
||||||
|
path: dist
|
||||||
|
- name: Publish AAR to GH gradle registry
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
run: platforms/android/publish_android_package.sh -s
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
61
platforms/android/publish_android_package.sh
Executable file
61
platforms/android/publish_android_package.sh
Executable file
@@ -0,0 +1,61 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
EC_ASSETS_FOLDER=lib/src/main/assets/element-call
|
||||||
|
CURRENT_DIR=$( dirname -- "${BASH_SOURCE[0]}" )
|
||||||
|
|
||||||
|
pushd $CURRENT_DIR > /dev/null
|
||||||
|
|
||||||
|
function build_assets() {
|
||||||
|
echo "Building the 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 assets to the Android project..."
|
||||||
|
cp -R ../../dist/* $EC_ASSETS_FOLDER
|
||||||
|
|
||||||
|
echo "Cleaning up copied assets..."
|
||||||
|
# Remove .gz assets as they will be marked as duplicate by the Android packaging process
|
||||||
|
rm $EC_ASSETS_FOLDER/index.html.gz 2> /dev/null
|
||||||
|
rm $EC_ASSETS_FOLDER/assets/*.gz 2> /dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
getopts :sh opt
|
||||||
|
case $opt in
|
||||||
|
s)
|
||||||
|
echo "Using existing assets."
|
||||||
|
SKIP=1
|
||||||
|
;;
|
||||||
|
h)
|
||||||
|
echo "-s: will skip building the assets and just publish the library."
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ -d $EC_ASSETS_FOLDER ]; then
|
||||||
|
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."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
copy_assets
|
||||||
|
else
|
||||||
|
build_assets
|
||||||
|
copy_assets
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Publishing the Android project"
|
||||||
|
./gradlew publishAllPublicationsToGithubPackagesRepository
|
||||||
|
|
||||||
|
popd > /dev/null
|
||||||
Reference in New Issue
Block a user