Skip to content

Commit

Permalink
Add Session support (#43)
Browse files Browse the repository at this point in the history
* new sample app

* add fastlane_session feature

* add project path env to the sample app

* wire in the session

* dep add github.com/bitrise-tools/go-steputils/tools

* fix project path

*  -

* clean

* using fastlane devportalservice package from the isunes-connect-deliver step for FASTLANE_SESSION

* add github.com/bitrise-io/steps-deploy-to-itunesconnect-deliver/devportalservice dependency
  • Loading branch information
BirmacherAkos authored Mar 22, 2019
1 parent a20006b commit 53fde93
Show file tree
Hide file tree
Showing 7 changed files with 248 additions and 4 deletions.
18 changes: 18 additions & 0 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,11 @@
[prune]
go-tests = true
unused-packages = true

[[constraint]]
branch = "master"
name = "github.com/bitrise-tools/go-steputils"

[[constraint]]
branch = "master"
name = "github.com/bitrise-io/steps-deploy-to-itunesconnect-deliver"
14 changes: 10 additions & 4 deletions bitrise.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git

app:
envs:
- SAMPLE_APP_URL: "https://github.com/bitrise-samples/sample-apps-ios-simple-objc-with-uitest.git"
- LANE: tests
- SAMPLE_APP_URL: "https://github.com/bitrise-samples/sample-apps-fastlane-test.git"
- LANE: release
- BITRISE_PROJECT_PATH: ./sample-apps-fastlane-test.xcodeproj
- BITRISE_SCHEME: sample-apps-fastlane-test

workflows:
# ----------------------------------------------------------------
Expand All @@ -28,11 +30,15 @@ workflows:
- is_create_path: true
- script:
inputs:
- content: git clone $SAMPLE_APP_URL -b fastlane .
- content: git clone $SAMPLE_APP_URL .
- [email protected]:
inputs:
- generate_profiles: 'yes'
- distribution_type: app-store
- path::./:
inputs:
- lane: $LANE
- work_dir: ios-simple-objc
- work_dir: ./

# ----------------------------------------------------------------
# --- Utility workflows
Expand Down
25 changes: 25 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import (
"github.com/bitrise-io/go-utils/fileutil"
"github.com/bitrise-io/go-utils/log"
"github.com/bitrise-io/go-utils/pathutil"
"github.com/bitrise-io/steps-deploy-to-itunesconnect-deliver/devportalservice"
"github.com/bitrise-tools/go-steputils/tools"
shellquote "github.com/kballard/go-shellquote"
)

Expand Down Expand Up @@ -139,6 +141,29 @@ func main() {

log.Donef("Expanded WorkDir: %s", workDir)

//
// Fastlane session
fmt.Println()
log.Infof("Ensure cookies for Apple Developer Portal")

fs, errors := devportalservice.SessionData()
if errors != nil {
log.Warnf("Failed to activate the Bitrise Apple Developer Portal connection: %s\nRead more: https://devcenter.bitrise.io/getting-started/signing-up/connecting-apple-dev-account/\nerrors:")
for _, err := range errors {
log.Errorf("%s\n", err)
}
} else {
if err := tools.ExportEnvironmentWithEnvman("FASTLANE_SESSION", fs); err != nil {
failf("Failed to export FASTLANE_SESSION, error: %s", err)
}

if err := os.Setenv("FASTLANE_SESSION", fs); err != nil {
failf("Failed to set FASTLANE_SESSION env, error: %s", err)
}

log.Donef("Session exported")
}

// Split lane option
laneOptions, err := shellquote.Split(configs.Lane)
if err != nil {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions vendor/github.com/bitrise-tools/go-steputils/tools/tools.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 53fde93

Please sign in to comment.