GitNex/.gitlab-ci.yml
qwerty287 42f6611585 Use another docker image (#1103)
Try to fix our issues with gitlab ci.

# DISCLAIMER
I don't really know if this will work. I pulled the image locally and ran it, `apksigner` is available, `./gradlew assembleFreeRelease` runs without issues, but I don't know if this will behave differently on gitlab. However, this took a long time to run because it is installing an emulator and sdk tools, don't know why.

Co-authored-by: qwerty287 <ndev@web.de>
Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/1103
Reviewed-by: M M Arif <mmarif@noreply.codeberg.org>
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
2022-04-04 18:47:40 +02:00

117 lines
2.4 KiB
YAML

stages:
- build
- sign
- publish
- locales
on_setup:
image: curlimages/curl:7.77.0
stage: .pre
only:
- main
- tags
variables:
INSTANCE: "https://codeberg.org"
MAIN_REPO: gitnex/GitNex
STATE: pending
script:
- ./scripts/add-commit-status.sh
build:
image: alvrme/alpine-android:android-31-jdk11
stage: build
only:
- main
- tags
script:
- ./gradlew assembleFreeRelease
artifacts:
paths:
- app/build/outputs/
expire_in: 15 minutes
sign:
image: alvrme/alpine-android:android-31-jdk11
stage: sign
only:
- main
- tags
variables:
OUTPUT: "signed.apk"
INSTANCE: "https://codeberg.org"
KS_FILE: "ci_keystore.jks"
script:
- ./scripts/sign-build.sh
artifacts:
paths:
- signed.apk
expire_in: 15 minutes
latest:
image: curlimages/curl:7.77.0
stage: publish
only:
- main
- tags
variables:
WEBDAV_USERNAME: "GitNexBot"
PLUGIN_FILE: "signed.apk"
PLUGIN_DESTINATION: "https://cloud.swatian.com/remote.php/dav/files/GitNexBot/gitnex/builds/latest.apk"
script:
- curl -T "$PLUGIN_FILE" -u "$WEBDAV_USERNAME":"$WEBDAV_PASSWORD" "$PLUGIN_DESTINATION"
release:
image: curlimages/curl:7.77.0
stage: publish
only:
- tags
variables:
WEBDAV_USERNAME: "GitNexBot"
PLUGIN_FILE: "signed.apk"
script:
- "[[ $CI_COMMIT_REF_NAME == *'-rc'* ]] && echo 'Upload blocked. Build seems to be a release candidate.' && exit 0"
- curl -T "$PLUGIN_FILE" -u "$WEBDAV_USERNAME":"$WEBDAV_PASSWORD" 'https://cloud.swatian.com/remote.php/dav/files/GitNexBot/gitnex/releases/'"$CI_COMMIT_REF_NAME"'.apk'
push_translations:
image: crowdin/cli:3.7.8
stage: locales
only:
refs:
- main
changes:
- app/src/main/res/values/strings.xml
script:
- echo "Set up Crowdin CLI"
- cp crowdin.example.yml crowdin.yml
- sed -i 's/-removed-/'"$CROWDIN_TOKEN"'/' crowdin.yml
- echo "Push translations"
- crowdin push
on_success:
image: curlimages/curl:7.77.0
stage: .post
only:
- main
- tags
variables:
INSTANCE: "https://codeberg.org"
MAIN_REPO: gitnex/GitNex
STATE: success
script:
- ./scripts/add-commit-status.sh
when: on_success
on_failure:
image: curlimages/curl:7.77.0
stage: .post
only:
- main
- tags
variables:
INSTANCE: "https://codeberg.org"
MAIN_REPO: gitnex/GitNex
STATE: failure
script:
- ./scripts/add-commit-status.sh
when: on_failure