Skip to content

Commit b95b98b

Browse files
ci(release): publish Runtime Kits to AutoJs6-Runtime-Kits
Users kept downloading autojs6-runtime-kit-*.zip from the AutoJs6 Releases instead of the APKs. The tag workflow now uploads the five kits to the same-tag Release of SuperMonster003/AutoJs6-Runtime-Kits and no longer touches the AutoJs6 Release, so it only needs contents: read. - The upload uses AUTOJS6_RUNTIME_KIT_REPO_TOKEN, else AUTOJS6_PLUGIN_REPO_TOKEN, and removes older kit files of that tag. - repository_dispatch adds runtime_kit_repo next to tag and source_repo. - In SuperMonster003/AutoJs6 a missing token fails the run instead of silently skipping the upload or the dispatch. - The release checklist and the template repository guide follow.
1 parent 857503e commit b95b98b

14 files changed

Lines changed: 123 additions & 37 deletions

‎.github/workflows/release-runtime-kit.yml‎

Lines changed: 48 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,16 @@ on:
2525
default: false
2626

2727
permissions:
28-
contents: write
28+
contents: read
2929
actions: read
3030

3131
jobs:
3232
build-runtime-kit:
3333
runs-on: ubuntu-latest
34+
env:
35+
# AutoJs6 Releases carry only the host APKs, because users kept downloading the kits by mistake.
36+
# Not an AutoJs6-Plugin-* repository: the official plugin index treats every Release there as a plugin version.
37+
RUNTIME_KIT_REPO: SuperMonster003/AutoJs6-Runtime-Kits
3438

3539
steps:
3640
- name: Checkout AutoJs6
@@ -86,14 +90,47 @@ jobs:
8690
name: autojs6-runtime-kit
8791
path: app/build/runtime-kit/autojs6-runtime-kit-*.zip
8892

89-
- name: Upload Runtime Kit release asset
93+
- name: Publish Runtime Kit to the Runtime Kit repository
9094
env:
91-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
95+
GH_TOKEN: ${{ secrets.AUTOJS6_RUNTIME_KIT_REPO_TOKEN || secrets.AUTOJS6_PLUGIN_REPO_TOKEN }}
9296
TARGET_TAG: ${{ inputs.tag || github.ref_name }}
9397
run: |
98+
set -euo pipefail
99+
shopt -s nullglob
100+
if [ -z "$GH_TOKEN" ]; then
101+
if [ "$GITHUB_REPOSITORY" = "SuperMonster003/AutoJs6" ]; then
102+
echo "AUTOJS6_RUNTIME_KIT_REPO_TOKEN or AUTOJS6_PLUGIN_REPO_TOKEN must be configured." >&2
103+
exit 1
104+
fi
105+
echo "No Runtime Kit repository token is configured; skipping the Runtime Kit Release."
106+
exit 0
107+
fi
94108
tag="$TARGET_TAG"
95-
gh release view "$tag" >/dev/null 2>&1 || gh release create "$tag" --title "$tag" --notes "AutoJs6 Runtime Kit $tag"
96-
gh release upload "$tag" app/build/runtime-kit/autojs6-runtime-kit-*.zip --clobber
109+
archives=(app/build/runtime-kit/autojs6-runtime-kit-*.zip)
110+
test "${#archives[@]}" -gt 0
111+
notes="Runtime Kit archives built from $GITHUB_REPOSITORY $tag ($GITHUB_SHA).
112+
113+
These zip files are build inputs of SuperMonster003/AutoJs6-Plugin-APK-Builder-Template and cannot be installed on a device.
114+
To install AutoJs6, download an APK from https://github.com/$GITHUB_REPOSITORY/releases/tag/$tag"
115+
if gh release view "$tag" --repo "$RUNTIME_KIT_REPO" >/dev/null 2>&1; then
116+
gh release edit "$tag" --repo "$RUNTIME_KIT_REPO" --notes "$notes"
117+
else
118+
gh release create "$tag" --repo "$RUNTIME_KIT_REPO" --title "$tag Runtime Kit" --notes "$notes"
119+
fi
120+
gh release upload "$tag" "${archives[@]}" --repo "$RUNTIME_KIT_REPO" --clobber
121+
122+
# A rerun after a version change would otherwise leave two kits of one variant, which the template rejects.
123+
uploaded_names="$(for file in "${archives[@]}"; do basename "$file"; done)"
124+
while IFS= read -r asset_name; do
125+
case "$asset_name" in
126+
autojs6-runtime-kit-*) ;;
127+
*) continue ;;
128+
esac
129+
if ! grep -Fxq -- "$asset_name" <<< "$uploaded_names"; then
130+
echo "Removing stale Runtime Kit asset $asset_name."
131+
gh release delete-asset "$tag" "$asset_name" --repo "$RUNTIME_KIT_REPO" --yes
132+
fi
133+
done < <(gh release view "$tag" --repo "$RUNTIME_KIT_REPO" --json assets --jq '.assets[].name')
97134
98135
- name: Trigger APK Builder plugin repository
99136
env:
@@ -102,6 +139,10 @@ jobs:
102139
TARGET_TAG: ${{ inputs.tag || github.ref_name }}
103140
run: |
104141
if [ -z "$GH_TOKEN" ]; then
142+
if [ "$GITHUB_REPOSITORY" = "SuperMonster003/AutoJs6" ]; then
143+
echo "AUTOJS6_PLUGIN_REPO_TOKEN must be configured." >&2
144+
exit 1
145+
fi
105146
echo "AUTOJS6_PLUGIN_REPO_TOKEN is not configured; skipping repository_dispatch."
106147
exit 0
107148
fi
@@ -110,4 +151,5 @@ jobs:
110151
"repos/$PLUGIN_REPO/dispatches" \
111152
-f event_type=autojs6_runtime_kit_released \
112153
-f client_payload[tag]="$tag" \
113-
-f client_payload[source_repo]="$GITHUB_REPOSITORY"
154+
-f client_payload[source_repo]="$GITHUB_REPOSITORY" \
155+
-f client_payload[runtime_kit_repo]="$RUNTIME_KIT_REPO"

‎.readme/README-ar.md‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -880,7 +880,10 @@ autojs6-v6.6.2-arm64-v8a-0f2a9d74.apk
880880
- Run prepush_check.py, push master, then check Android CI and Markdown integrity
881881
- Create the GitHub release with tag vX.Y.Z on the release commit: title "X.Y.Z @ YYYY/MM/DD", notes from the zh-Hans changelog of that version
882882
with the dependency entries folded into one CHANGELOG.md link [ same as the latest release history in README ], assets from app/app/releases
883-
- The tag runs .github/workflows/release-runtime-kit.yml, which uploads autojs6-runtime-kit-*.zip to the same release
884-
and dispatches the APK Builder Template plugin repository; check that run
883+
- The tag runs .github/workflows/release-runtime-kit.yml, which uploads autojs6-runtime-kit-*.zip to the same tag release
884+
of SuperMonster003/AutoJs6-Runtime-Kits [ never to the AutoJs6 release, users mistook the zip files for the app ]
885+
and dispatches the APK Builder Template plugin repository; check both runs and that the AutoJs6 release holds only APKs
886+
- The upload token is AUTOJS6_RUNTIME_KIT_REPO_TOKEN, else AUTOJS6_PLUGIN_REPO_TOKEN [ Contents: write on AutoJs6-Runtime-Kits ];
887+
to republish the template for an older tag, run its build-from-runtime-kit.yml instead of rerunning this tag workflow
885888
- Close the issues that the release notes or comments promised to close after the release
886889
)

‎.readme/README-en.md‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -880,7 +880,10 @@ Some contributors do not appear correctly in the [GitHub Contributors](https://g
880880
- Run prepush_check.py, push master, then check Android CI and Markdown integrity
881881
- Create the GitHub release with tag vX.Y.Z on the release commit: title "X.Y.Z @ YYYY/MM/DD", notes from the zh-Hans changelog of that version
882882
with the dependency entries folded into one CHANGELOG.md link [ same as the latest release history in README ], assets from app/app/releases
883-
- The tag runs .github/workflows/release-runtime-kit.yml, which uploads autojs6-runtime-kit-*.zip to the same release
884-
and dispatches the APK Builder Template plugin repository; check that run
883+
- The tag runs .github/workflows/release-runtime-kit.yml, which uploads autojs6-runtime-kit-*.zip to the same tag release
884+
of SuperMonster003/AutoJs6-Runtime-Kits [ never to the AutoJs6 release, users mistook the zip files for the app ]
885+
and dispatches the APK Builder Template plugin repository; check both runs and that the AutoJs6 release holds only APKs
886+
- The upload token is AUTOJS6_RUNTIME_KIT_REPO_TOKEN, else AUTOJS6_PLUGIN_REPO_TOKEN [ Contents: write on AutoJs6-Runtime-Kits ];
887+
to republish the template for an older tag, run its build-from-runtime-kit.yml instead of rerunning this tag workflow
885888
- Close the issues that the release notes or comments promised to close after the release
886889
)

‎.readme/README-es.md‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -880,7 +880,10 @@ Algunos contribuyentes no aparecen en [GitHub Contributors](https://github.com/S
880880
- Run prepush_check.py, push master, then check Android CI and Markdown integrity
881881
- Create the GitHub release with tag vX.Y.Z on the release commit: title "X.Y.Z @ YYYY/MM/DD", notes from the zh-Hans changelog of that version
882882
with the dependency entries folded into one CHANGELOG.md link [ same as the latest release history in README ], assets from app/app/releases
883-
- The tag runs .github/workflows/release-runtime-kit.yml, which uploads autojs6-runtime-kit-*.zip to the same release
884-
and dispatches the APK Builder Template plugin repository; check that run
883+
- The tag runs .github/workflows/release-runtime-kit.yml, which uploads autojs6-runtime-kit-*.zip to the same tag release
884+
of SuperMonster003/AutoJs6-Runtime-Kits [ never to the AutoJs6 release, users mistook the zip files for the app ]
885+
and dispatches the APK Builder Template plugin repository; check both runs and that the AutoJs6 release holds only APKs
886+
- The upload token is AUTOJS6_RUNTIME_KIT_REPO_TOKEN, else AUTOJS6_PLUGIN_REPO_TOKEN [ Contents: write on AutoJs6-Runtime-Kits ];
887+
to republish the template for an older tag, run its build-from-runtime-kit.yml instead of rerunning this tag workflow
885888
- Close the issues that the release notes or comments promised to close after the release
886889
)

‎.readme/README-fr.md‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -880,7 +880,10 @@ Certains contributeurs ne figurant pas correctement dans [GitHub Contributors](h
880880
- Run prepush_check.py, push master, then check Android CI and Markdown integrity
881881
- Create the GitHub release with tag vX.Y.Z on the release commit: title "X.Y.Z @ YYYY/MM/DD", notes from the zh-Hans changelog of that version
882882
with the dependency entries folded into one CHANGELOG.md link [ same as the latest release history in README ], assets from app/app/releases
883-
- The tag runs .github/workflows/release-runtime-kit.yml, which uploads autojs6-runtime-kit-*.zip to the same release
884-
and dispatches the APK Builder Template plugin repository; check that run
883+
- The tag runs .github/workflows/release-runtime-kit.yml, which uploads autojs6-runtime-kit-*.zip to the same tag release
884+
of SuperMonster003/AutoJs6-Runtime-Kits [ never to the AutoJs6 release, users mistook the zip files for the app ]
885+
and dispatches the APK Builder Template plugin repository; check both runs and that the AutoJs6 release holds only APKs
886+
- The upload token is AUTOJS6_RUNTIME_KIT_REPO_TOKEN, else AUTOJS6_PLUGIN_REPO_TOKEN [ Contents: write on AutoJs6-Runtime-Kits ];
887+
to republish the template for an older tag, run its build-from-runtime-kit.yml instead of rerunning this tag workflow
885888
- Close the issues that the release notes or comments promised to close after the release
886889
)

‎.readme/README-ja.md‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -880,7 +880,10 @@ AutoJs6 プロジェクト開発に参加したすべての貢献者に感謝し
880880
- Run prepush_check.py, push master, then check Android CI and Markdown integrity
881881
- Create the GitHub release with tag vX.Y.Z on the release commit: title "X.Y.Z @ YYYY/MM/DD", notes from the zh-Hans changelog of that version
882882
with the dependency entries folded into one CHANGELOG.md link [ same as the latest release history in README ], assets from app/app/releases
883-
- The tag runs .github/workflows/release-runtime-kit.yml, which uploads autojs6-runtime-kit-*.zip to the same release
884-
and dispatches the APK Builder Template plugin repository; check that run
883+
- The tag runs .github/workflows/release-runtime-kit.yml, which uploads autojs6-runtime-kit-*.zip to the same tag release
884+
of SuperMonster003/AutoJs6-Runtime-Kits [ never to the AutoJs6 release, users mistook the zip files for the app ]
885+
and dispatches the APK Builder Template plugin repository; check both runs and that the AutoJs6 release holds only APKs
886+
- The upload token is AUTOJS6_RUNTIME_KIT_REPO_TOKEN, else AUTOJS6_PLUGIN_REPO_TOKEN [ Contents: write on AutoJs6-Runtime-Kits ];
887+
to republish the template for an older tag, run its build-from-runtime-kit.yml instead of rerunning this tag workflow
885888
- Close the issues that the release notes or comments promised to close after the release
886889
)

‎.readme/README-ko.md‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -880,7 +880,10 @@ AutoJs6 프로젝트 개발에 참여한 모든 기여자분들께 감사합니
880880
- Run prepush_check.py, push master, then check Android CI and Markdown integrity
881881
- Create the GitHub release with tag vX.Y.Z on the release commit: title "X.Y.Z @ YYYY/MM/DD", notes from the zh-Hans changelog of that version
882882
with the dependency entries folded into one CHANGELOG.md link [ same as the latest release history in README ], assets from app/app/releases
883-
- The tag runs .github/workflows/release-runtime-kit.yml, which uploads autojs6-runtime-kit-*.zip to the same release
884-
and dispatches the APK Builder Template plugin repository; check that run
883+
- The tag runs .github/workflows/release-runtime-kit.yml, which uploads autojs6-runtime-kit-*.zip to the same tag release
884+
of SuperMonster003/AutoJs6-Runtime-Kits [ never to the AutoJs6 release, users mistook the zip files for the app ]
885+
and dispatches the APK Builder Template plugin repository; check both runs and that the AutoJs6 release holds only APKs
886+
- The upload token is AUTOJS6_RUNTIME_KIT_REPO_TOKEN, else AUTOJS6_PLUGIN_REPO_TOKEN [ Contents: write on AutoJs6-Runtime-Kits ];
887+
to republish the template for an older tag, run its build-from-runtime-kit.yml instead of rerunning this tag workflow
885888
- Close the issues that the release notes or comments promised to close after the release
886889
)

‎.readme/README-ru.md‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -880,7 +880,10 @@ autojs6-v6.6.2-arm64-v8a-0f2a9d74.apk
880880
- Run prepush_check.py, push master, then check Android CI and Markdown integrity
881881
- Create the GitHub release with tag vX.Y.Z on the release commit: title "X.Y.Z @ YYYY/MM/DD", notes from the zh-Hans changelog of that version
882882
with the dependency entries folded into one CHANGELOG.md link [ same as the latest release history in README ], assets from app/app/releases
883-
- The tag runs .github/workflows/release-runtime-kit.yml, which uploads autojs6-runtime-kit-*.zip to the same release
884-
and dispatches the APK Builder Template plugin repository; check that run
883+
- The tag runs .github/workflows/release-runtime-kit.yml, which uploads autojs6-runtime-kit-*.zip to the same tag release
884+
of SuperMonster003/AutoJs6-Runtime-Kits [ never to the AutoJs6 release, users mistook the zip files for the app ]
885+
and dispatches the APK Builder Template plugin repository; check both runs and that the AutoJs6 release holds only APKs
886+
- The upload token is AUTOJS6_RUNTIME_KIT_REPO_TOKEN, else AUTOJS6_PLUGIN_REPO_TOKEN [ Contents: write on AutoJs6-Runtime-Kits ];
887+
to republish the template for an older tag, run its build-from-runtime-kit.yml instead of rerunning this tag workflow
885888
- Close the issues that the release notes or comments promised to close after the release
886889
)

‎.readme/README-zh-Hans.md‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -880,7 +880,10 @@ autojs6-v6.6.2-arm64-v8a-0f2a9d74.apk
880880
- Run prepush_check.py, push master, then check Android CI and Markdown integrity
881881
- Create the GitHub release with tag vX.Y.Z on the release commit: title "X.Y.Z @ YYYY/MM/DD", notes from the zh-Hans changelog of that version
882882
with the dependency entries folded into one CHANGELOG.md link [ same as the latest release history in README ], assets from app/app/releases
883-
- The tag runs .github/workflows/release-runtime-kit.yml, which uploads autojs6-runtime-kit-*.zip to the same release
884-
and dispatches the APK Builder Template plugin repository; check that run
883+
- The tag runs .github/workflows/release-runtime-kit.yml, which uploads autojs6-runtime-kit-*.zip to the same tag release
884+
of SuperMonster003/AutoJs6-Runtime-Kits [ never to the AutoJs6 release, users mistook the zip files for the app ]
885+
and dispatches the APK Builder Template plugin repository; check both runs and that the AutoJs6 release holds only APKs
886+
- The upload token is AUTOJS6_RUNTIME_KIT_REPO_TOKEN, else AUTOJS6_PLUGIN_REPO_TOKEN [ Contents: write on AutoJs6-Runtime-Kits ];
887+
to republish the template for an older tag, run its build-from-runtime-kit.yml instead of rerunning this tag workflow
885888
- Close the issues that the release notes or comments promised to close after the release
886889
)

‎.readme/README-zh-Hant-HK.md‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -880,7 +880,10 @@ autojs6-v6.6.2-arm64-v8a-0f2a9d74.apk
880880
- Run prepush_check.py, push master, then check Android CI and Markdown integrity
881881
- Create the GitHub release with tag vX.Y.Z on the release commit: title "X.Y.Z @ YYYY/MM/DD", notes from the zh-Hans changelog of that version
882882
with the dependency entries folded into one CHANGELOG.md link [ same as the latest release history in README ], assets from app/app/releases
883-
- The tag runs .github/workflows/release-runtime-kit.yml, which uploads autojs6-runtime-kit-*.zip to the same release
884-
and dispatches the APK Builder Template plugin repository; check that run
883+
- The tag runs .github/workflows/release-runtime-kit.yml, which uploads autojs6-runtime-kit-*.zip to the same tag release
884+
of SuperMonster003/AutoJs6-Runtime-Kits [ never to the AutoJs6 release, users mistook the zip files for the app ]
885+
and dispatches the APK Builder Template plugin repository; check both runs and that the AutoJs6 release holds only APKs
886+
- The upload token is AUTOJS6_RUNTIME_KIT_REPO_TOKEN, else AUTOJS6_PLUGIN_REPO_TOKEN [ Contents: write on AutoJs6-Runtime-Kits ];
887+
to republish the template for an older tag, run its build-from-runtime-kit.yml instead of rerunning this tag workflow
885888
- Close the issues that the release notes or comments promised to close after the release
886889
)

0 commit comments

Comments
 (0)