.github/workflows/run.yml #37
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
schedule: | |
- cron: '0 3 * * 6' | |
workflow_dispatch: | |
jobs: | |
run: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: run | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
#[ "${GITHUB_TOKEN}" ] || exit 0 | |
api="https://api.github.com/repos/${GITHUB_REPOSITORY}/releases" | |
tag="$(date +%Y%m%d)" auth="Authorization: token ${GITHUB_TOKEN}" | |
_id="$(curl -fs -H "${auth}" "${api}/tags/${tag}" | jq -r .id)" | |
[ -z "${_id}" ] || [ "${_id}" = "null" ] || exit 0 | |
git clone "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}" . | |
for i in Full CromiteWebView; do | |
cat <<EOF >>"${i}/module.prop" | |
version=${tag} | |
versionCode=${tag} | |
EOF | |
done | |
./build-package pull | |
#./build-package all ||: | |
./build-package cromitewebview ||: | |
_id="$(echo "{\"tag_name\":\"${tag}\",\"name\":\"${tag}\",\"body\":\"${tag}\",\"draft\":true}" | curl -s -d@- -H "${auth}" -H "Content-Type: application/json" "${api}" | jq -r .id)" | |
[ -n "${_id}" ] && [ "${_id}" != "null" ] || exit 1 | |
gh_release_put(){ curl -fs -H "${auth}" -H "Content-Type: application/octet-stream" -o /dev/null --data-binary "@${1}" "https://uploads.github.com/repos/${GITHUB_REPOSITORY}/releases/${_id}/assets?name=${2}"; } | |
#for i in NanoDroid NanoDroid-BromiteWebView NanoDroid-MulchWebView; do | |
for i in NanoDroid-CromiteWebView; do | |
cat <<EOF >"${i}.json" | |
{ | |
"version":"${tag}", | |
"versionCode":"${tag}", | |
"zipUrl": "https://github.com/${GITHUB_REPOSITORY}/releases/download/${tag}/${i}-23.2.${tag}.zip" | |
} | |
EOF | |
gh_release_put "${i}.json" "${i}.json" | |
gh_release_put "${i}-23.2.${tag}.zip" "${i}-23.2.${tag}.zip" | |
gh_release_put "${i}-23.2.${tag}.zip.sha256" "${i}-23.2.${tag}.zip.sha256" | |
done | |
echo '{"draft":false}' | curl -s -o /dev/null -XPATCH -d@- -H "${auth}" -H "Content-Type: application/json" "${api}/${_id}" |