From 5ba46cb3b3b4e6f09a3aec95244735ad85ea75b6 Mon Sep 17 00:00:00 2001 From: jastornig Date: Tue, 2 Jan 2024 13:20:31 +0000 Subject: [PATCH] Update .gitlab-ci.yml file --- .gitlab-ci.yml | 47 ++++++++++++++++++++++++++++++++--------------- 1 file changed, 32 insertions(+), 15 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 875d494..6d12529 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -20,6 +20,7 @@ stages: - lint # List of stages for jobs, and their order of execution - build + - deploy - release lint_job: @@ -65,27 +66,15 @@ build_job: when: on_success expire_in: 60 days - - -release_job: - stage: release - image: "registry.gitlab.com/gitlab-org/release-cli:latest" +deploy_job: + stage: deploy + image: "alpine:latest" needs: - job: build_job artifacts: true rules: - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_PIPELINE_SOURCE == "push" when: on_success - release: - tag_name: 'v0.$CI_PIPELINE_IID' - description: 'v0.$CI_PIPELINE_IID create by pipeline' - ref: '$CI_COMMIT_SHA' - assets: - links: - - name: APK - url: '${CI_PROJECT_URL}/-/jobs/${BUILD_JOB_ID}/artifacts/file/${RELEASE_APK}' - - name: Download APK - url: $url script: - apk add curl jq - content=$(curl https://api.dropbox.com/oauth2/token -d grant_type=refresh_token -d refresh_token=$REFRESH_TOKEN -d client_id=$CLIENT_KEY -d client_secret=$CLIENT_SECRET) @@ -97,5 +86,33 @@ release_job: - | content=$(curl -X POST https://api.dropboxapi.com/2/sharing/create_shared_link_with_settings --header "Authorization: Bearer $token" --header "Content-Type: application/json" --data @data.json) - url=$(echo $content | jq -r ".url") + - echo APK_URL=$url >> urlEnv.env + artifacts: + untracked: false + when: on_success + expire_in: 30 days + reports: + dotenv: urlEnv.env + + +release_job: + stage: release + image: "registry.gitlab.com/gitlab-org/release-cli:latest" + needs: + - job: deploy_job + artifacts: true + rules: + - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_PIPELINE_SOURCE == "push" + when: on_success + release: + tag_name: 'v0.$CI_PIPELINE_IID' + description: 'v0.$CI_PIPELINE_IID create by pipeline' + ref: '$CI_COMMIT_SHA' + assets: + links: + - name: Download APK + url: $APK_URL + script: + - echo deploying \ No newline at end of file