feat: 支持android ios不同环境制品包构建
This commit is contained in:
parent
8aefee0ad1
commit
cfad7de35e
116
.gitlab-ci.yml
Normal file
116
.gitlab-ci.yml
Normal file
@ -0,0 +1,116 @@
|
||||
stages:
|
||||
- test
|
||||
- package
|
||||
- release-artifacts
|
||||
- notification
|
||||
|
||||
variables:
|
||||
LC_ALL: "en_US.UTF-8"
|
||||
LANG: "en_US.UTF-8"
|
||||
|
||||
|
||||
.build_rule:
|
||||
tags:
|
||||
- macos
|
||||
- flutter
|
||||
rules:
|
||||
- if: $CI_COMMIT_BRANCH == "develop"
|
||||
- if: $CI_COMMIT_BRANCH == "release"
|
||||
- if: $CI_COMMIT_BRANCH =~ /feat_[a-zA-Z]+/
|
||||
- if: $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z]+\.[0-9]+)?$/
|
||||
|
||||
|
||||
.print_env:
|
||||
stage: test
|
||||
extends: .build_rule
|
||||
before_script:
|
||||
- java --version
|
||||
- printenv | while IFS='=' read -r key value; do echo "$key=$value"; done
|
||||
after_script:
|
||||
- echo "finished"
|
||||
|
||||
.setup_fastlane_android:
|
||||
extends: .build_rule
|
||||
before_script:
|
||||
- flutter pub get
|
||||
- bundle install --gemfile android/Gemfile --quiet
|
||||
|
||||
|
||||
.setup_fastlane_ios:
|
||||
extends: .build_rule
|
||||
before_script:
|
||||
- flutter pub get
|
||||
- bundle install --gemfile ios/Gemfile --quiet
|
||||
|
||||
test_lint_check:
|
||||
stage: test
|
||||
extends: .print_env
|
||||
script:
|
||||
- echo "run lint check or per-test here"
|
||||
tags:
|
||||
- macos
|
||||
- flutter
|
||||
|
||||
build_android:
|
||||
stage: package
|
||||
extends: .setup_fastlane_android
|
||||
script: bash android/build.sh
|
||||
artifacts:
|
||||
paths:
|
||||
- build/app/outputs/flutter-apk/
|
||||
|
||||
build_ios:
|
||||
stage: package
|
||||
extends: .setup_fastlane_ios
|
||||
script:
|
||||
- bash ios/build.sh
|
||||
artifacts:
|
||||
paths:
|
||||
- build/app/outputs/flutter-ipa
|
||||
|
||||
create-release:
|
||||
stage: release-artifacts
|
||||
extends: .build_rule
|
||||
dependencies:
|
||||
- build_android
|
||||
- build_ios
|
||||
needs:
|
||||
- job: build_android
|
||||
artifacts: true
|
||||
- job: build_ios
|
||||
artifacts: true
|
||||
rules:
|
||||
- if: $CI_COMMIT_TAG
|
||||
before_script:
|
||||
- echo "start create release"
|
||||
script:
|
||||
- export StarLock_VERSION=${CI_COMMIT_TAG#*-}
|
||||
- echo "Uploading StarLock-${StarLock_VERSION} packages to
|
||||
${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/StarLock/${StarLock_VERSION}/StarLock-${StarLock_VERSION}-*"
|
||||
- 'curl -i --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file build/app/outputs/flutter-apk/app-xhj-release.apk
|
||||
"${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/StarLock/${StarLock_VERSION}/app-xhj-release.apk"'
|
||||
- 'curl -i --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file build/app/outputs/flutter-apk/app-sky-release.apk
|
||||
"${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/StarLock/${StarLock_VERSION}/app-sky-release.apk"'
|
||||
- 'curl -i --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file build/app/outputs/flutter-ipa/app-starlock-release-xhj.ipa
|
||||
"${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/StarLock/${StarLock_VERSION}/app-starlock-release-xhj.ipa"'
|
||||
- 'curl -i --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file build/app/outputs/flutter-ipa/app-starlock-release-sky.ipa
|
||||
"${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/StarLock/${StarLock_VERSION}/app-starlock-release-sky.ipa"'
|
||||
release:
|
||||
name: '$CI_COMMIT_TAG'
|
||||
description: 'Created Release By GitLab CI/CD'
|
||||
tag_name: '$CI_COMMIT_TAG'
|
||||
ref: '$CI_COMMIT_TAG'
|
||||
assets:
|
||||
links:
|
||||
- name: 'xhj binary package (Android)'
|
||||
url: '${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/StarLock/${CI_COMMIT_TAG}/app-xhj-release.apk'
|
||||
link_type: 'package'
|
||||
- name: 'sky binary package (Android)'
|
||||
url: '${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/StarLock/${CI_COMMIT_TAG}/app-sky-release.apk'
|
||||
link_type: 'package'
|
||||
- name: 'xhj binary package (iOS)'
|
||||
url: '${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/StarLock/${CI_COMMIT_TAG}/app-starlock-release-xhj.ipa'
|
||||
link_type: 'package'
|
||||
- name: 'sky binary package (iOS)'
|
||||
url: '${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/StarLock/${CI_COMMIT_TAG}/app-starlock-release-sky.ipa'
|
||||
link_type: 'package'
|
||||
Loading…
x
Reference in New Issue
Block a user