build apk
This commit is contained in:
parent
8bd4a3f5d1
commit
cd5e23364d
|
@ -76,3 +76,41 @@ assembleDebug:
|
||||||
paths:
|
paths:
|
||||||
- app/build/outputs/
|
- app/build/outputs/
|
||||||
|
|
||||||
|
## PROTECTED VARIABLES TO SET IN GITLAB:
|
||||||
|
# - GITLAB_API_TOKEN: token you create on Gitlab
|
||||||
|
# - NC_REMOTE_DIR: like https://YOUR_NEXTCLOUD/remote.php/dav/files/YOUR_USER/mastalab (no trailing slash)
|
||||||
|
# - NC_SHARE_URL: share the folder in Nextcloud with public link and put your public link here (no trailing slash)
|
||||||
|
# - NC_USER: nextcloud user
|
||||||
|
# - NC_PASSWORD: nextcloud password
|
||||||
|
## Protect all tags in Gitlab repo settings (do a wildcard, ie '*')
|
||||||
|
# For now, it uses the assembleDebug builds, you'll need to create a job in build-and-test to create the apks, with only: - tags and add except: - tags to assembleDebug (like in debugTests)
|
||||||
|
# In it, put something like this to get your signature key file:
|
||||||
|
# - curl -s --output signature.jsk -u "${NC_USER}:${NC_PASSWORD}" "https://YOUR_NEXTCLOUD/remote.php/dav/files/YOUR_USER/signature.jsk"
|
||||||
|
putApkOnTags:
|
||||||
|
image: hatsoftwares/curl-jq:latest
|
||||||
|
stage: tag
|
||||||
|
retry: 2
|
||||||
|
cache:
|
||||||
|
key: "${CI_COMMIT_TAG}"
|
||||||
|
paths:
|
||||||
|
- app/build/outputs/apk/fdroid_acad/debug/app-fdroid_acad-debug.apk
|
||||||
|
- app/build/outputs/apk/fdroid_full/debug/app-fdroid_full-debug.apk
|
||||||
|
policy: pull
|
||||||
|
script:
|
||||||
|
- export PROJECT_API_URL="https://framagit.org/api/v4/projects/${CI_PROJECT_ID}"
|
||||||
|
- export DESCRIPTION_URL="${PROJECT_API_URL}/repository/tags/${CI_COMMIT_TAG}"
|
||||||
|
- export RELEASE_URL="${DESCRIPTION_URL}/release"
|
||||||
|
- export NC_UPLOAD_URL="${NC_REMOTE_DIR}/${CI_COMMIT_TAG}"
|
||||||
|
- export NC_DOWNLOAD_URL="${NC_SHARE_URL}/download?path=%2F${CI_COMMIT_TAG}%2F&files="
|
||||||
|
- 'export HEADER="Private-Token: ${GITLAB_API_TOKEN}"'
|
||||||
|
- export acadUrl="${NC_DOWNLOAD_URL}app-fdroid_acad-debug.apk"
|
||||||
|
- export fullUrl="${NC_DOWNLOAD_URL}app-fdroid_full-debug.apk"
|
||||||
|
- 'curl -s -u "${NC_USER}:${NC_PASSWORD}" -X MKCOL "${NC_UPLOAD_URL}"'
|
||||||
|
- 'curl -s -u "${NC_USER}:${NC_PASSWORD}" -T app/build/outputs/apk/fdroid_full/debug/app-fdroid_full-debug.apk "${NC_UPLOAD_URL}/app-fdroid_full-debug.apk"'
|
||||||
|
- 'curl -s -u "${NC_USER}:${NC_PASSWORD}" -T app/build/outputs/apk/fdroid_acad/debug/app-fdroid_acad-debug.apk "${NC_UPLOAD_URL}/app-fdroid_acad-debug.apk"'
|
||||||
|
- export description=$(curl -s --header "${HEADER}" "${DESCRIPTION_URL}" | jq .release.description | sed -e 's@"@@g')
|
||||||
|
- if [[ $description == 'null' ]]; then export METHOD="POST"; echo -e "[Get the acad version](${acadUrl})\n\n[Get the full version](${fullUrl})" > /tmp/text; fi
|
||||||
|
- if [[ $description != 'null' ]]; then export METHOD="PUT"; echo -e "${description}\n\n[Get the acad version](${acadUrl})\n\n[Get the full version](${fullUrl})" > /tmp/text; fi
|
||||||
|
- curl -s --request $METHOD --data-urlencode "description@/tmp/text" --header "${HEADER}" "${RELEASE_URL}"
|
||||||
|
only:
|
||||||
|
- tags
|
||||||
|
|
Loading…
Reference in New Issue