Resolve "make Releases public and downloadable"

This commit is contained in:
jastornig 2023-12-19 16:03:51 +00:00
parent 7d87557fe5
commit 5d783f724d
2 changed files with 41 additions and 27 deletions

View file

@ -16,48 +16,58 @@
# This specific template is located at:
# https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Getting-Started.gitlab-ci.yml
stages: # List of stages for jobs, and their order of execution
- build
# - test
# - deploy
- release
build-job:
build_job:
image: "reactnativecommunity/react-native-android:latest"
stage: build # This job runs in the build stage, which runs first.
rules:
- if: $COMMIT_BRANCH == "main"
when: manual
- if: $COMMIT_BRANCH != "main"
when: never
script:
- echo $PWD
- echo $CI_PROJECT_DIR
- echo BUILD_JOB_ID=$CI_JOB_ID >> environment.env
- yarn add expo
- npx expo prebuild --platform android
- cd android && ./gradlew assembleRelease
- cd $CI_PROJECT_DIR
- cp android/app/build/outputs/apk/release/app-release.apk finanzfuchs-$CI_COMMIT_REF_NAME.apk
- cp android/app/build/outputs/apk/release/app-release.apk finanzfuchs-is1-group-g-$CI_COMMIT_REF_NAME.apk
- echo RELEASE_APK=finanzfuchs-is1-group-g-$CI_COMMIT_REF_NAME.apk >> environment.env
artifacts:
untracked: false
name: $CI_PROJECT_NAME-group-g-finanzfuchs-$CI_COMMIT_REF_NAME
paths:
- "finanzfuchs-is1-group-g-$CI_COMMIT_REF_NAME.apk"
reports:
dotenv: environment.env
when: on_success
expire_in: 30 days
expire_in: 60 days
when: manual
# unit-test-job: # This job runs in the test stage.
# stage: test # It only starts when the job in the build stage completes successfully.
# script:
# - echo "Running unit tests... This will take about 60 seconds."
# - sleep 60
# - echo "Code coverage is 90%"
# lint-test-job: # This job also runs in the test stage.
# stage: test # It can run at the same time as unit-test-job (in parallel).
# script:
# - echo "Linting code... This will take about 10 seconds."
# - sleep 10
# - echo "No lint issues found."
# deploy-job: # This job runs in the deploy stage.
# stage: deploy # It only runs when *both* jobs in the test stage complete successfully.
# environment: production
# script:
# - echo "Deploying application..."
# - echo "Application successfully deployed."
release_job:
stage: release
image: "registry.gitlab.com/gitlab-org/release-cli:latest"
needs:
- job: build_job
rules:
- if: $COMMIT_BRANCH == "main"
when: manual
- if: $COMMIT_BRANCH != "main"
when: never
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}'
script:
- echo "Deploying"