borepin/.gitlab-ci.yml

403 lines
13 KiB
YAML
Raw Normal View History

2020-09-17 10:50:56 +00:00
variables:
2022-01-03 21:13:03 +00:00
VERSION_PATTERN: '/v\d+\.\d+(\.\d+)?/'
GIT_SUBMODULE_STRATEGY: recursive
LIB_RELEASE_FOLDER: 'Borepin\Borepin\bin\Release'
UWP_RELEASE_FOLDER: 'Borepin\Borepin.UWP\bin\x86\Release'
TEST_FOLDER: 'Tests\bin\Release'
WIN_NUGET_PATH: 'C:\ProgramData\chocolatey\bin\nuget.exe'
2022-11-04 04:21:59 +00:00
WIN_MSBUILD_PATH: 'C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\msbuild.exe'
2022-01-03 21:13:03 +00:00
WIN_NUNIT_PATH: 'C:\ProgramData\chocolatey\bin\nunit3-console.exe'
2020-09-17 10:50:56 +00:00
2021-09-07 15:38:12 +02:00
stages:
2022-01-03 21:13:03 +00:00
- build
- test
- pack
- deploy
2020-09-17 10:50:56 +00:00
2022-01-03 21:13:03 +00:00
build_Base:
stage: build
tags:
- fabinfra
- public
- windows
- powershell
- xamarin
script:
- '& "$WIN_NUGET_PATH" restore'
- '& "$WIN_MSBUILD_PATH" /t:Restore /p:Configuration=Debug /t:Borepin'
2020-09-17 14:13:05 +00:00
2021-09-07 15:38:12 +02:00
build_Android:
2022-01-03 21:13:03 +00:00
stage: build
needs:
- build_Base
tags:
- fabinfra
- public
- windows
- powershell
- xamarin
script:
- '& "$WIN_NUGET_PATH" restore'
- '& "$WIN_MSBUILD_PATH" /t:Restore /p:Configuration=Debug /t:Borepin_Android'
build_UWP:
stage: build
needs:
- build_Base
tags:
- fabinfra
- public
- windows
- powershell
- xamarin
script:
- '& "$WIN_NUGET_PATH" restore'
- '& "$WIN_MSBUILD_PATH" /t:Restore /p:Configuration=Debug /t:Borepin_UWP'
2020-09-17 14:42:11 +00:00
2021-09-07 15:38:12 +02:00
build_iOS:
2022-01-03 21:13:03 +00:00
stage: build
needs:
- build_Base
tags:
- fabinfra
- public
- macos
- shell
- xamarin
script:
- 'nuget restore'
- 'msbuild /t:Restore'
- 'msbuild /p:Configuration=Debug /t:Borepin_iOS'
2020-09-17 15:41:21 +00:00
2021-09-07 15:38:12 +02:00
build_GTK:
2022-01-03 21:13:03 +00:00
stage: build
needs:
- build_Base
tags:
- docker
image: registry.gitlab.com/fabinfra/gtk-sharp-build:latest
script:
- 'nuget restore'
- 'msbuild -t:Restore'
- 'msbuild -p:Configuration=Debug -t:Borepin_GTK'
pack_Android_AAB:
stage: pack
needs:
- build_Android
rules:
- if: $CI_COMMIT_TAG != null && $CI_COMMIT_TAG =~ /v\d+\.\d+(\.\d+)?/
tags:
- fabinfra
- internal
- windows
- powershell
- xamarin
before_script:
- '$Env:VERSION_NUMBER="$CI_COMMIT_TAG".SubString(1)'
- '$Env:BUILD_NUMBER="$CI_PIPELINE_ID"'
script:
- '& "$WIN_NUGET_PATH" restore'
- '[System.IO.File]::WriteAllBytes("$(pwd)/fabaccess.keystore", [System.Convert]::FromBase64String($AndroidKeyStore))'
- '& "$WIN_MSBUILD_PATH" /t:Restore /t:Borepin_Android:SetVersion /p:Configuration=Release /target:Borepin_Android:PackageForAndroid /target:Borepin_Android:SignAndroidPackage /p:AndroidKeyStore="True" /p:AndroidSigningKeyStore="$(pwd)/fabaccess.keystore" /p:AndroidSigningKeyPass="$AndroidKeyStore_Password" /p:AndroidSigningKeyAlias="$AndroidKeyStore_ID" /p:AndroidSigningStorePass="$AndroidKeyStore_Password"'
- 'rm "$(pwd)/fabaccess.keystore"'
artifacts:
expire_in: 1 week
paths:
- Borepin/Borepin.Android/bin/Release/org.fab_infra.fabaccess-Signed.aab
pack_Android_APK:
stage: pack
needs:
- build_Android
rules:
- if: $CI_COMMIT_TAG != null && $CI_COMMIT_TAG =~ /v\d+\.\d+(\.\d+)?/
tags:
- fabinfra
- internal
- windows
- powershell
- xamarin
before_script:
- '$Env:VERSION_NUMBER="$CI_COMMIT_TAG".SubString(1)'
- '$Env:BUILD_NUMBER="$CI_PIPELINE_ID"'
- '$Env:ANDROID_PKG_FORMAT="apk"'
script:
- '& "$WIN_NUGET_PATH" restore'
- '[System.IO.File]::WriteAllBytes("$(pwd)/fabaccess.keystore", [System.Convert]::FromBase64String($AndroidKeyStore))'
- '& "$WIN_MSBUILD_PATH" /t:Restore /t:Borepin_Android:SetVersion /p:Configuration=Release /target:Borepin_Android /target:Borepin_Android:SignAndroidPackage /p:AndroidKeyStore="True" /p:AndroidSigningKeyStore="$(pwd)/fabaccess.keystore" /p:AndroidSigningKeyPass="$AndroidKeyStore_Password" /p:AndroidSigningKeyAlias="$AndroidKeyStore_ID" /p:AndroidSigningStorePass="$AndroidKeyStore_Password"'
- 'rm "$(pwd)/fabaccess.keystore"'
artifacts:
expire_in: 1 week
paths:
- Borepin/Borepin.Android/bin/Release/org.fab_infra.fabaccess-Signed.apk
2023-01-25 19:30:31 +00:00
pack_FDroid_APK:
stage: pack
needs:
- build_Android
rules:
- if: $CI_COMMIT_TAG != null && $CI_COMMIT_TAG =~ /v\d+\.\d+(\.\d+)?/
tags:
- fabinfra
- internal
- windows
- powershell
- xamarin
before_script:
- '$Env:VERSION_NUMBER="$CI_COMMIT_TAG".SubString(1)'
- '$Env:BUILD_NUMBER="$CI_PIPELINE_ID"'
- '$Env:ANDROID_PKG_FORMAT="apk"'
script:
- '& "$WIN_NUGET_PATH" restore'
- '[System.IO.File]::WriteAllBytes("$(pwd)/fabaccess.keystore", [System.Convert]::FromBase64String($FDroidKeyStore))'
- '& "$WIN_MSBUILD_PATH" /t:Restore /t:Borepin_Android:SetVersion /p:Configuration=Release /target:Borepin_Android /target:Borepin_Android:SignAndroidPackage /p:AndroidKeyStore="True" /p:AndroidSigningKeyStore="$(pwd)/fabaccess.keystore" /p:AndroidSigningKeyPass="$FDroidKeyStore_Password" /p:AndroidSigningKeyAlias="$FDroidKeyStore_ID" /p:AndroidSigningStorePass="$FDroidKeyStore_Password"'
- 'rm "$(pwd)/fabaccess.keystore"'
artifacts:
expire_in: 1 week
paths:
- Borepin/Borepin.Android/bin/Release/org.fab_infra.fabaccess-Signed.apk
2022-01-03 21:13:03 +00:00
pack_iOS:
stage: pack
needs:
- build_iOS
rules:
- if: $CI_COMMIT_TAG != null && $CI_COMMIT_TAG =~ /v\d+\.\d+(\.\d+)?/
tags:
- fabinfra
- internal
- macos
- shell
- xamarin
before_script:
- 'export VERSION_NUMBER=${CI_COMMIT_TAG:1}'
- 'export BUILD_NUMBER="$CI_PIPELINE_ID"'
script:
- 'nuget restore'
- 'msbuild /t:Restore'
- 'msbuild /t:Borepin_iOS:SetVersion /t:Borepin_iOS /p:Configuration=Release /p:Platform=iPhone /p:ArchiveOnBuild=true /p:BuildIpa=true'
artifacts:
expire_in: 1 week
paths:
- Borepin/Borepin.iOS/bin/iPhone/Release/Borepin.iOS.ipa
deploy_Android_Internal:
stage: deploy
needs:
- pack_Android_AAB
rules:
- if: $CI_COMMIT_TAG != null && $CI_COMMIT_TAG =~ /v\d+\.\d+(\.\d+)?/
tags:
- docker
image: registry.gitlab.com/fabinfra/gtk-sharp-build:latest
variables:
LC_ALL: 'en_US.UTF-8'
LANG: 'en_US.UTF-8'
before_script:
- 'export VERSION_NUMBER=${CI_COMMIT_TAG:1}'
- 'export BUILD_NUMBER="$CI_PIPELINE_ID"'
- 'echo $play_store_credentials > play-store-credentials.json'
script:
- 'bundle install'
- 'bundle exec fastlane supply --aab Borepin/Borepin.Android/bin/Release/org.fab_infra.fabaccess-Signed.aab --track internal'
after_script:
- 'rm play-store-credentials.json'
2022-11-14 15:09:19 +00:00
pages:
2022-09-11 20:13:24 +00:00
stage: deploy
needs:
2023-01-25 19:30:31 +00:00
- pack_FDroid_APK
2022-09-11 20:13:24 +00:00
rules:
- if: $CI_COMMIT_TAG != null && $CI_COMMIT_TAG =~ /v\d+\.\d+(\.\d+)?/
tags:
- docker
2023-01-25 19:30:31 +00:00
image: registry.gitlab.com/fdroid/docker-executable-fdroidserver:latest
2022-09-11 20:13:24 +00:00
variables:
LC_ALL: 'en_US.UTF-8'
LANG: 'en_US.UTF-8'
before_script:
- 'export VERSION_NUMBER=${CI_COMMIT_TAG:1}'
- 'export BUILD_NUMBER="$CI_PIPELINE_ID"'
2023-01-25 19:32:27 +00:00
- 'cp -r fdroid/* .'
- 'echo "keystorepass: ${FDroid_KeyStore_Password}" >> config.yml'
- 'echo "keypass: ${FDroid_KeyStore_Password}" >> config.yml'
- 'echo ${FDroid_KeyStore} | base64 -d > keystore.p12'
2022-09-11 20:13:24 +00:00
script:
2023-01-25 19:32:27 +00:00
- 'mkdir repo'
- 'cp Borepin/Borepin.Android/bin/Release/org.fab_infra.fabaccess-Signed.apk repo/'
- 'fdroid update'
2022-09-11 20:13:24 +00:00
- 'mkdir -p public'
2023-01-25 19:30:31 +00:00
- 'cp -r repo/* public/'
2023-01-25 19:32:27 +00:00
- 'rm keystore.p12'
2022-09-11 20:13:24 +00:00
artifacts:
paths:
- public
2023-01-25 00:49:10 +00:00
upload_binaries:
stage: deploy
needs:
- pack_Android_APK
tags:
- docker
image: curlimages/curl:latest
before_script: []
cache: []
script:
- 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file Borepin/Borepin.Android/bin/Release/org.fab_infra.fabaccess-Signed.apk "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/borepin/${CI_COMMIT_TAG}/org.fab_infra.fabaccess-Signed.apk"'
rules:
- if: $CI_COMMIT_TAG != null && $CI_COMMIT_TAG =~ /v\d+\.\d+(\.\d+)?/
2022-09-11 20:13:24 +00:00
2023-01-25 00:49:10 +00:00
release_job:
stage: deploy
needs:
- upload_binaries
image: registry.gitlab.com/gitlab-org/release-cli:latest
2023-01-25 19:47:13 +00:00
tags:
- docker
2023-01-25 00:49:10 +00:00
rules:
- if: $CI_COMMIT_TAG != null && $CI_COMMIT_TAG =~ /v\d+\.\d+(\.\d+)?/
when: manual
script:
- echo "Creating GitLab release…"
release:
name: "Borepin ${CI_COMMIT_TAG}"
description: "GitLab CI auto-created release"
tag_name: "release/${CI_COMMIT_TAG}"
assets:
links:
- name: 'Borepin signed apk'
url: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/borepin/${CI_COMMIT_TAG}/org.fab_infra.fabaccess-Signed.apk"
2022-09-11 20:13:24 +00:00
2022-01-03 21:13:03 +00:00
deploy_Android_Beta:
stage: deploy
needs:
- deploy_Android_Internal
rules:
- if: $CI_COMMIT_TAG != null && $CI_COMMIT_TAG =~ /v\d+\.\d+(\.\d+)?/
when: manual
tags:
- docker
image: registry.gitlab.com/fabinfra/gtk-sharp-build:latest
variables:
LC_ALL: 'en_US.UTF-8'
LANG: 'en_US.UTF-8'
before_script:
- 'export VERSION_NUMBER=${CI_COMMIT_TAG:1}'
- 'export BUILD_NUMBER="$CI_PIPELINE_ID"'
- 'echo $play_store_credentials > play-store-credentials.json'
script:
- 'bundle install'
- 'bundle exec fastlane supply --track internal --track_promote_to beta'
after_script:
- 'rm play-store-credentials.json'
deploy_Android_Production:
stage: deploy
needs:
- deploy_Android_Beta
rules:
- if: $CI_COMMIT_TAG != null && $CI_COMMIT_TAG =~ /v\d+\.\d+(\.\d+)?/
when: manual
tags:
- docker
image: registry.gitlab.com/fabinfra/gtk-sharp-build:latest
variables:
LC_ALL: 'en_US.UTF-8'
LANG: 'en_US.UTF-8'
before_script:
- 'export VERSION_NUMBER=${CI_COMMIT_TAG:1}'
- 'export BUILD_NUMBER="$CI_PIPELINE_ID"'
- 'echo $play_store_credentials > play-store-credentials.json'
script:
- 'bundle install'
- 'bundle exec fastlane supply --track internal --track_promote_to production'
after_script:
- 'rm play-store-credentials.json'
deploy_iOS_Internal:
stage: deploy
needs:
- pack_iOS
rules:
- if: $CI_COMMIT_TAG != null && $CI_COMMIT_TAG =~ /v\d+\.\d+(\.\d+)?/
tags:
- fabinfra
- internal
- macos
- shell
- xamarin
variables:
LC_ALL: 'en_US.UTF-8'
LANG: 'en_US.UTF-8'
before_script:
- 'export VERSION_NUMBER=${CI_COMMIT_TAG:1}'
- 'export BUILD_NUMBER="$CI_PIPELINE_ID"'
- 'echo $app_store_credentials > app-store-credentials.json'
- 'export PATH="/usr/local/opt/ruby/bin:$PATH"'
script:
- 'bundle install'
- 'bundle update fastlane'
- 'bundle exec fastlane pilot upload --api_key_path app-store-credentials.json --ipa Borepin/Borepin.iOS/bin/iPhone/Release/Borepin.iOS.ipa'
after_script:
- 'rm app-store-credentials.json'
deploy_iOS_Beta:
stage: deploy
needs:
- pack_iOS
rules:
- if: $CI_COMMIT_TAG != null && $CI_COMMIT_TAG =~ /v\d+\.\d+(\.\d+)?/
when: manual
tags:
- fabinfra
- internal
- macos
- shell
- xamarin
variables:
LC_ALL: 'en_US.UTF-8'
LANG: 'en_US.UTF-8'
before_script:
- 'export VERSION_NUMBER=${CI_COMMIT_TAG:1}'
- 'export BUILD_NUMBER="$CI_PIPELINE_ID"'
- 'echo $app_store_credentials > app-store-credentials.json'
- 'export PATH="/usr/local/opt/ruby/bin:$PATH"'
script:
- 'bundle install'
- 'bundle update fastlane'
- 'bundle exec fastlane pilot upload --api_key_path app-store-credentials.json --ipa Borepin/Borepin.iOS/bin/iPhone/Release/Borepin.iOS.ipa --distribute_external true --groups Beta --changelog "Bugfixes and/or new features"'
after_script:
- 'rm app-store-credentials.json'
deploy_iOS_Production:
stage: deploy
needs:
- deploy_iOS_Beta
rules:
- if: $CI_COMMIT_TAG != null && $CI_COMMIT_TAG =~ /v\d+\.\d+(\.\d+)?/
when: manual
tags:
- fabinfra
- internal
- macos
- shell
- xamarin
variables:
LC_ALL: 'en_US.UTF-8'
LANG: 'en_US.UTF-8'
before_script:
- 'export VERSION_NUMBER=${CI_COMMIT_TAG:1}'
- 'export BUILD_NUMBER="$CI_PIPELINE_ID"'
- 'echo $app_store_credentials > app-store-credentials.json'
- 'export PATH="/usr/local/opt/ruby/bin:$PATH"'
script:
- 'bundle install'
- 'bundle update fastlane'
- 'bundle exec fastlane deliver submit_build --build_number $BUILD_NUMBER --submit_for_review true --automatic_release true --force true --skip_metadata true --skip_screenshots true --skip_binary_upload true --api_key_path app-store-credentials.json'
after_script:
- 'rm app-store-credentials.json'