Skip to content
Merged
Show file tree
Hide file tree
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
70 changes: 23 additions & 47 deletions .github/workflows/update-libs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ permissions:
contents: write

jobs:
update-libs:
release:
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
Expand All @@ -31,62 +31,38 @@ jobs:
cache-disabled: true
add-job-summary: 'never'

- name: Compute release tag
id: tag
env:
RUN_NUMBER: ${{ github.run_number }}
run: echo "name=build-$(date -u +%Y-%m-%d)-${RUN_NUMBER}" >> "$GITHUB_OUTPUT"

- name: Run update-libs script
env:
REF: ${{ github.event.inputs.ref }}
REF: ${{ inputs.ref }}
run: ./scripts/update-libs.sh --ref "$REF"

- name: Upload Beepy CGP
uses: actions/upload-artifact@v4
with:
name: beepy
path: Beepy/build/plugin/*.cgp
if-no-files-found: error

- name: Upload apk-viewer CGP
uses: actions/upload-artifact@v4
with:
name: apk-viewer
path: apk-viewer/build/plugin/*.cgp
if-no-files-found: error

- name: Upload markdown-preview CGP
uses: actions/upload-artifact@v4
with:
name: markdown-preview
path: markdown-preview/build/plugin/*.cgp
if-no-files-found: error

- name: Upload keystore-generator CGP
uses: actions/upload-artifact@v4
with:
name: keystore-generator
path: keystore-generator/build/plugin/*.cgp
if-no-files-found: error

- name: Upload snippets CGP
uses: actions/upload-artifact@v4
with:
name: snippets
path: snippets/build/plugin/*.cgp
if-no-files-found: error

- name: Upload ndk-installer CGP
uses: actions/upload-artifact@v4
with:
name: ndk-installer
path: ndk-installer-plugin/build/plugin/*.cgp
if-no-files-found: error

- name: Commit updated jars
id: commit
run: |
sha=$(git -C .cache/CodeOnTheGo rev-parse --short HEAD)
git config user.name "ADFA"
git config user.email "dev-team@appdevforall.org"
git add libs/
if git diff --cached --quiet; then
echo "No changes to libs/ — nothing to commit."
exit 0
else
git commit -m "chore: update libs from CodeOnTheGo@${sha}"
git push
fi
git commit -m "chore: update libs from CodeOnTheGo@${sha}"
git push
echo "codeonthego_sha=${sha}" >> "$GITHUB_OUTPUT"
echo "head_sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"

- name: Publish release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.tag.outputs.name }}
target_commitish: ${{ steps.commit.outputs.head_sha }}
body: Built against CodeOnTheGo@${{ steps.commit.outputs.codeonthego_sha }}.
fail_on_unmatched_files: true
files: '*/build/plugin/*.cgp'
18 changes: 16 additions & 2 deletions scripts/update-libs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ set -euo pipefail

REPO_URL="https://github.com/appdevforall/CodeOnTheGo.git"
DEFAULT_REF="stage"
PLUGIN_BUILDER_ID="com.itsaky.androidide.plugins.build"

REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
LIBS_DIR="$REPO_ROOT/libs"
Expand Down Expand Up @@ -108,15 +109,28 @@ echo "Updated libs/ from CodeOnTheGo@$CODEONTHEGO_SHA"
printf " %-20s %s\n" "plugin-api.jar" "$(du -h "$LIBS_DIR/plugin-api.jar" | cut -f1)"
printf " %-20s %s\n" "gradle-plugin.jar" "$(du -h "$LIBS_DIR/gradle-plugin.jar" | cut -f1)"

PLUGINS=(Beepy apk-viewer markdown-preview keystore-generator snippets ndk-installer-plugin)
PLUGINS=()
for build_file in "$REPO_ROOT"/*/build.gradle.kts; do
[ -f "$build_file" ] || continue
if grep -qF "$PLUGIN_BUILDER_ID" "$build_file"; then
PLUGINS+=("$(basename "$(dirname "$build_file")")")
fi
done

if [ "${#PLUGINS[@]}" -eq 0 ]; then
echo "Error: no example plugins discovered (looked for sibling dirs whose build.gradle.kts applies $PLUGIN_BUILDER_ID)." >&2
exit 1
fi

echo ""
echo "Discovered example plugins: ${PLUGINS[*]}"
echo "Building all example plugins against the refreshed libs..."
for plugin in "${PLUGINS[@]}"; do
echo ""
echo "→ $plugin"
(
cd "$REPO_ROOT/$plugin"
if [[ "$plugin" == "ndk-installer-plugin" ]]; then
if grep -q 'downloadAssets' build.gradle.kts; then
./gradlew --console=plain downloadAssets
fi
./gradlew --console=plain assemblePlugin
Expand Down