Skip to content

Commit

Permalink
Merge pull request #154 from Backbase/develop
Browse files Browse the repository at this point in the history
Release 1.0.0
  • Loading branch information
gderaco authored Nov 5, 2021
2 parents 7bd04ba + 708627b commit c5f1619
Show file tree
Hide file tree
Showing 10 changed files with 208 additions and 19 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
source 'https://rubygems.org'

gem 'slather'
gem 'nokogiri', '1.11.4'
gem 'nokogiri', '1.12.5'
8 changes: 4 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ GEM
concurrent-ruby (1.1.7)
i18n (1.8.5)
concurrent-ruby (~> 1.0)
mini_portile2 (2.5.1)
mini_portile2 (2.6.1)
minitest (5.14.2)
nanaimo (0.3.0)
nokogiri (1.11.4)
mini_portile2 (~> 2.5.0)
nokogiri (1.12.5)
mini_portile2 (~> 2.6.1)
racc (~> 1.4)
racc (1.5.2)
slather (2.5.0)
Expand All @@ -43,7 +43,7 @@ PLATFORMS
ruby

DEPENDENCIES
nokogiri (= 1.11.4)
nokogiri (= 1.12.5)
slather

BUNDLED WITH
Expand Down
2 changes: 1 addition & 1 deletion Sources/Variants/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ struct Variants: ParsableCommand {
static var configuration = CommandConfiguration(
commandName: "variants",
abstract: "A command-line tool to setup deployment variants and working CI/CD setup",
version: "0.9.4",
version: "1.0.0",
subcommands: [
Initializer.self,
Setup.self,
Expand Down
40 changes: 40 additions & 0 deletions Templates/ios/_fastlane/fastlane/Appstore
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
require File.expand_path('parameters/appstore_params.rb', __dir__)
require File.expand_path('parameters/project_params.rb', __dir__)

USERNAME = APPSTORE_PARAMS[:APPSTORE_USERNAME]
APPLE_ID = APPSTORE_PARAMS[:APPSTORE_APPLE_ID]
XCCONFIG_PATH = PROJECT_PARAMS[:XCCONFIG_PATH]

# --- Appstore

#
# ATTENTION:
#
# Deploying directly to AppStore
# using `pilot`, `deliver` or their aliases require
# authentication to AppStoreConnect.
#
# In order to have this handled automatically in
# your CI machine, you'll need an Application Specific Password
#
# Find more about it and how to generate yours in:
# https://docs.fastlane.tools/best-practices/continuous-integration/#application-specific-passwords
#

desc 'deploy app to AppStore'
private_lane :appstore_deploy do |options|
# Retrieve app identifier from config
app_identifier = get_xcconfig_value(
path: XCCONFIG_PATH,
name: 'V_BUNDLE_ID'
)

deliver(
submit_for_review: false,
automatic_release: false,
force: true, # Skip HTMl report verification
skip_metadata: true,
skip_screenshots: true,
skip_binary_upload: false
)
end
54 changes: 54 additions & 0 deletions Templates/ios/_fastlane/fastlane/Deliverfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
require File.expand_path('parameters/match_params.rb', __dir__)

CODE_SIGNING_IDENTITY = MATCH_PARAMS[:TEAMNAME]
TEAM_ID = MATCH_PARAMS[:TEAMID]
EXPORT_METHOD = MATCH_PARAMS[:EXPORTMETHOD]

# This is the example Deliverfile
#
# You can remove those parts you don't need
#
# Everything next to a # is a comment and will be ignored

########################################
# App Metadata
########################################

apple_id ''

# This folder has to include one folder for each language
# More information about automatic screenshot upload:
# https://github.com/KrauseFx/deliver#upload-screenshots-to-itunes-connect
screenshots_path ""

app_icon ""

title({
"en-US" => ""
})

# This log has to include the changes made for the release. It has been commented out for the purpose of developer interest to choose either from repository or from fastlane.
# changelog({
# "en-US" => "iPhone 6 (Plus) Support"
# })

description({
'en-US' => ""
})

copyright ""

app_review_information({
first_name: "",
last_name: "",
phone_number: "",
email_address: "",
demo_user: "",
demo_password: "",
notes: ""
})

primary_category ""
secondary_category ""

ratings_config_path ""
2 changes: 2 additions & 0 deletions Templates/ios/_fastlane/fastlane/Deploy
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ lane :deploy do |options|
appcenter_deploy
elsif destination == 'testflight'
testflight_deploy
elsif destination == 'appstore'
appstore_deploy
end


Expand Down
2 changes: 2 additions & 0 deletions Templates/ios/_fastlane/fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import('Sonar')
import('SwiftLint')
import('Tests')
import('TestFlight')
import('Appstore')
import('Deliverfile')

# --- Before all, prepare

Expand Down
19 changes: 11 additions & 8 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ inputs:
platform:
description: '"ios" or "android".'
required: false
default: 'default'
variant:
description: 'Variant you would like to switch to.'
required: true
Expand All @@ -38,29 +39,31 @@ runs:
make ci
cd ${{ env.project_path }}
if [[ ${{ inputs.platform }} != '' ]]; then
if [[ ${{ inputs.verbose }} == true ]]; then
if [[ ${{ inputs.platform }} == default ]];
then
if ${{ inputs.verbose }}
then
variants switch \
--spec ${{ inputs.spec }} \
--variant ${{ inputs.variant }} \
--platform ${{ inputs.platform }} \
--verbose
else
variants switch \
--spec ${{ inputs.spec }} \
--variant ${{ inputs.variant }} \
--platform ${{ inputs.platform }}
--variant ${{ inputs.variant }}
fi
else
if [[ ${{ inputs.verbose }} == true ]]; then
if ${{ inputs.verbose }}
then
variants switch \
--spec ${{ inputs.spec }} \
--variant ${{ inputs.variant }} \
--platform ${{ inputs.platform }} \
--verbose
else
variants switch \
--spec ${{ inputs.spec }} \
--variant ${{ inputs.variant }}
--variant ${{ inputs.variant }} \
--platform ${{ inputs.platform }}
fi
fi
28 changes: 24 additions & 4 deletions docs/STORE_DESTINATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,7 @@ Note that by not specifying or specifying an unsupported store will fallback to
>
>
AppStore is dependent on [Issue #81](https://github.com/Backbase/variants/issues/81)

#### Example
#### Example for iOS

Assume we have an iOS project, which production variant (default) should deploy to *Apple's AppStore*. A beta variant should be deployed to *Apple's TestFlight*. And an internal enterprise variant of this application (using an enterprise developer account) should be deployed to *AppCenter*. This could be achieved with the following:

Expand All @@ -76,10 +74,32 @@ ios:
...
```

#### Example for Android

Assume we have an Android project, which production variant (default) should deploy to *Google's Playstore*. And an internal enterprise variant of this application (using an enterprise developer account) should be deployed to *AppCenter*. This could be achieved with the following:

```yaml
android:
path: ...
app_name:
...
variants:
default:
version_name: 0.0.1
version_code: 1
store_destination: PlayStore
...
enterprise_release:
version_name: 0.0.1
version_code: 1
store_destination: AppCenter
...
```

Now, all we have to do is to switch to the correct variant and instruct *fastlane* to deploy as usual:

```sh
variants switch --platform ios --variant <value>
variants switch --platform <platformName(iOS or Android)> --variant <value>

fastlane deploy
```
Expand Down
70 changes: 69 additions & 1 deletion docs/USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,75 @@ ios:
value: $(inherited) -DBETA
destination: project
```
```yaml
android:
path: {{ PROJECT_PATH }}
app_name: {{ APP_NAME }}
app_identifier: {{ APP_IDENTIFIER }}
variants:
# Default variant is mandatory, do not remove
# Usually regarded as `production` variant.
default:
version_name: 0.0.1
version_code: 1
task_build: bundleProdRelease
task_unittest: testProdReleaseUnitTest
task_uitest: connectedProdReleaseAndroidTest
# 'store_destination' can be: AppCenter or PlayStore
store_destination: PlayStore
#
# custom: - Not required.
# You can have as many custom fields as possible.
# Only strings allowed.
#
# The value of will be written to 1 of 2 possible destinations:
# - project => variants.gradle
# - fastlane => fastlane/parameters/variants_params.rb
#
custom:
- name: SAMPLE_PROPERTY
value: SAMPLE_VALUE
destination: fastlane

- name: SAMPLE_PROPERTY_FROM_ENVIRONMENT
value: SAMPLE_ENVIRONMENT_VARIABLE
env: true
destination: fastlane

# Sample variant "BETA"
BETA:
id_suffix: beta
version_name: 0.0.1
version_code: 1
task_build: assembleDevDebug
task_unittest: testDevDebugUnitTest
task_uitest: connectedDevDebugAndroidTest
# 'store_destination' can be: AppCenter or PlayStore
store_destination: AppCenter
custom:
- name: SAMPLE_PROPERTY
value: SAMPLE_ENVIRONMENT_VARIABLE
env: true
destination: fastlane
# ----------------------------------------------------------------------
# custom: - Not required.
#
# Same as variant's `custom`, but this will be processed regardless of
# the chosen variant.
#
# Uncomment section below if necessary.
# ----------------------------------------------------------------------

#custom:
# - name: mvnUser
# value: MAVEN_USERNAME
# env: true
# destination: project
# - name: mvnPass
# value: MAVEN_PASSWORD
# env: true
# destination: project
```
#### Custom configuration

Configuration through custom properties can bring a lot of value to your variants, such as defining different API base URLs, or credentials using environment variables. This allows us to also define its destination. Certain properties should not be available to the project but to fastlane and vice-versa.
Expand Down

0 comments on commit c5f1619

Please sign in to comment.