Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e06e855a authored by Nishith  Khanna's avatar Nishith Khanna
Browse files

ci: add jobs so that tasks can be updated via AppLounge

parent b16eaca3
Loading
Loading
Loading
Loading
Loading
+93 −0
Original line number Diff line number Diff line
image: "registry.gitlab.e.foundation/e/os/docker-android-apps-cicd:latest"

variables:
  APK_PATH: "opentasks/build/outputs/apk/release"
  UNSIGNED_APK: "opentasks-release.apk"
  COMMUNITY_APK: "opentasks-release-community.apk"
  OFFICIAL_APK: "opentasks-release-official.apk"
  TEST_APK: "opentasks-release-test.apk"

.rules_protected_ref:
  rules: &rules_protected_ref
    - if: '$CI_PIPELINE_SOURCE != "schedule" && $CI_COMMIT_REF_PROTECTED == "true"'
    - when: never

.rules_protected_tag:
  rules: &rules_protected_tag
    - if: '$CI_COMMIT_TAG && $CI_COMMIT_REF_PROTECTED == "true"'
    - when: never

.rules_protected_tag_manual:
  rules: &rules_protected_tag_manual
    - if: '$CI_COMMIT_TAG && $CI_COMMIT_REF_PROTECTED == "true"'
      when: manual
    - when: never

stages:
  - build
  - gitlab_release

before_script:
  - export JAVA_HOME=/usr/lib/jvm/java-21-openjdk-amd64
@@ -20,3 +44,72 @@ build:
  artifacts:
    paths:
      - opentasks/build/outputs/apk/

init_submodules:
  stage: gitlab_release
  rules: *rules_protected_ref
  script:
    - |
      git clone https://gitlab.e.foundation/e/os/system-apps-update-info.git systemAppsUpdateInfo
  artifacts:
    paths:
      - systemAppsUpdateInfo/scripts/

generate-apks:
  stage: gitlab_release
  rules: *rules_protected_ref
  needs:
    - job: init_submodules
    - job: build
  script:
    - |
      ./systemAppsUpdateInfo/scripts/generate-apks.sh \
      "$APK_PATH" "$UNSIGNED_APK" "$COMMUNITY_APK" "$OFFICIAL_APK" "$TEST_APK"
  artifacts:
    paths:
      - $APK_PATH/$UNSIGNED_APK
      - $APK_PATH/$COMMUNITY_APK
      - $APK_PATH/$OFFICIAL_APK
      - $APK_PATH/$TEST_APK

create-json-files:
  stage: gitlab_release
  rules: *rules_protected_tag
  needs:
    - job: init_submodules
    - job: generate-apks
  script:
    - |
      ./systemAppsUpdateInfo/scripts/create-json-files.sh \
      "$APK_PATH" "$UNSIGNED_APK" "$COMMUNITY_APK" "$OFFICIAL_APK" "$TEST_APK"
  artifacts:
    paths:
      - community.json
      - official.json
      - test.json

create-test-release:
  stage: gitlab_release
  rules: *rules_protected_tag_manual
  needs:
    - job: init_submodules
    - job: create-json-files
      artifacts: false
  script:
    - |
      ./systemAppsUpdateInfo/scripts/create-test-release.sh \
      "$APK_PATH" "$TEST_APK"
  allow_failure: true

create-release:
  stage: gitlab_release
  rules: *rules_protected_tag_manual
  needs:
    - job: init_submodules
    - job: create-json-files
      artifacts: false
  script:
    - |
      ./systemAppsUpdateInfo/scripts/create-release.sh \
      "$APK_PATH" "$UNSIGNED_APK" "$COMMUNITY_APK" "$OFFICIAL_APK"
  allow_failure: true