Skip to content

Commit df841c8

Browse files
authored
Merge pull request #4 from appdevforall/ADFA-3824
ci: publish CGPs as GitHub releases instead of artifacts
2 parents 29c3d0e + 790e2eb commit df841c8

2 files changed

Lines changed: 39 additions & 49 deletions

File tree

‎.github/workflows/update-libs.yml‎

Lines changed: 23 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ permissions:
1212
contents: write
1313

1414
jobs:
15-
update-libs:
15+
release:
1616
runs-on: ubuntu-latest
1717
timeout-minutes: 45
1818
steps:
@@ -31,62 +31,38 @@ jobs:
3131
cache-disabled: true
3232
add-job-summary: 'never'
3333

34+
- name: Compute release tag
35+
id: tag
36+
env:
37+
RUN_NUMBER: ${{ github.run_number }}
38+
run: echo "name=build-$(date -u +%Y-%m-%d)-${RUN_NUMBER}" >> "$GITHUB_OUTPUT"
39+
3440
- name: Run update-libs script
3541
env:
36-
REF: ${{ github.event.inputs.ref }}
42+
REF: ${{ inputs.ref }}
3743
run: ./scripts/update-libs.sh --ref "$REF"
3844

39-
- name: Upload Beepy CGP
40-
uses: actions/upload-artifact@v4
41-
with:
42-
name: beepy
43-
path: Beepy/build/plugin/*.cgp
44-
if-no-files-found: error
45-
46-
- name: Upload apk-viewer CGP
47-
uses: actions/upload-artifact@v4
48-
with:
49-
name: apk-viewer
50-
path: apk-viewer/build/plugin/*.cgp
51-
if-no-files-found: error
52-
53-
- name: Upload markdown-preview CGP
54-
uses: actions/upload-artifact@v4
55-
with:
56-
name: markdown-preview
57-
path: markdown-preview/build/plugin/*.cgp
58-
if-no-files-found: error
59-
60-
- name: Upload keystore-generator CGP
61-
uses: actions/upload-artifact@v4
62-
with:
63-
name: keystore-generator
64-
path: keystore-generator/build/plugin/*.cgp
65-
if-no-files-found: error
66-
67-
- name: Upload snippets CGP
68-
uses: actions/upload-artifact@v4
69-
with:
70-
name: snippets
71-
path: snippets/build/plugin/*.cgp
72-
if-no-files-found: error
73-
74-
- name: Upload ndk-installer CGP
75-
uses: actions/upload-artifact@v4
76-
with:
77-
name: ndk-installer
78-
path: ndk-installer-plugin/build/plugin/*.cgp
79-
if-no-files-found: error
80-
8145
- name: Commit updated jars
46+
id: commit
8247
run: |
8348
sha=$(git -C .cache/CodeOnTheGo rev-parse --short HEAD)
8449
git config user.name "ADFA"
8550
git config user.email "dev-team@appdevforall.org"
8651
git add libs/
8752
if git diff --cached --quiet; then
8853
echo "No changes to libs/ — nothing to commit."
89-
exit 0
54+
else
55+
git commit -m "chore: update libs from CodeOnTheGo@${sha}"
56+
git push
9057
fi
91-
git commit -m "chore: update libs from CodeOnTheGo@${sha}"
92-
git push
58+
echo "codeonthego_sha=${sha}" >> "$GITHUB_OUTPUT"
59+
echo "head_sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
60+
61+
- name: Publish release
62+
uses: softprops/action-gh-release@v2
63+
with:
64+
tag_name: ${{ steps.tag.outputs.name }}
65+
target_commitish: ${{ steps.commit.outputs.head_sha }}
66+
body: Built against CodeOnTheGo@${{ steps.commit.outputs.codeonthego_sha }}.
67+
fail_on_unmatched_files: true
68+
files: '*/build/plugin/*.cgp'

‎scripts/update-libs.sh‎

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ set -euo pipefail
1212

1313
REPO_URL="https://github.com/appdevforall/CodeOnTheGo.git"
1414
DEFAULT_REF="stage"
15+
PLUGIN_BUILDER_ID="com.itsaky.androidide.plugins.build"
1516

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

111-
PLUGINS=(Beepy apk-viewer markdown-preview keystore-generator snippets ndk-installer-plugin)
112+
PLUGINS=()
113+
for build_file in "$REPO_ROOT"/*/build.gradle.kts; do
114+
[ -f "$build_file" ] || continue
115+
if grep -qF "$PLUGIN_BUILDER_ID" "$build_file"; then
116+
PLUGINS+=("$(basename "$(dirname "$build_file")")")
117+
fi
118+
done
119+
120+
if [ "${#PLUGINS[@]}" -eq 0 ]; then
121+
echo "Error: no example plugins discovered (looked for sibling dirs whose build.gradle.kts applies $PLUGIN_BUILDER_ID)." >&2
122+
exit 1
123+
fi
124+
112125
echo ""
126+
echo "Discovered example plugins: ${PLUGINS[*]}"
113127
echo "Building all example plugins against the refreshed libs..."
114128
for plugin in "${PLUGINS[@]}"; do
115129
echo ""
116130
echo "→ $plugin"
117131
(
118132
cd "$REPO_ROOT/$plugin"
119-
if [[ "$plugin" == "ndk-installer-plugin" ]]; then
133+
if grep -q 'downloadAssets' build.gradle.kts; then
120134
./gradlew --console=plain downloadAssets
121135
fi
122136
./gradlew --console=plain assemblePlugin

0 commit comments

Comments
 (0)