Update .gitlab-ci.yml file

This commit is contained in:
jastornig 2024-01-02 13:20:31 +00:00
parent 0240eb2562
commit 5ba46cb3b3

View file

@ -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