This repository was archived by the owner on Jan 26, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +101
-14
lines changed
Expand file tree Collapse file tree 4 files changed +101
-14
lines changed Original file line number Diff line number Diff line change @@ -2,33 +2,52 @@ language: php
22
33env :
44 global :
5- - coverage=false
6- - setup=basic
5+ - COVERAGE=false
6+ - SETUP=basic
7+ - DEPLOY_DOCS=false
78
89install :
9- - if [[ $setup = 'basic' ]]; then travis_retry composer install --prefer-dist --no-interaction --no-suggest; fi
10- - if [[ $setup = 'stable' ]]; then travis_retry composer update --prefer-dist --no-interaction --no-suggest --prefer-stable; fi
11- - if [[ $setup = 'lowest' ]]; then travis_retry composer update --prefer-dist --no-interaction --no-suggest --prefer-stable --prefer-lowest; fi
10+ - if [[ $SETUP = 'basic' ]]; then travis_retry composer install --prefer-dist --no-interaction --no-suggest; fi
11+ - if [[ $SETUP = 'stable' ]]; then travis_retry composer update --prefer-dist --no-interaction --no-suggest --prefer-stable; fi
12+ - if [[ $SETUP = 'lowest' ]]; then travis_retry composer update --prefer-dist --no-interaction --no-suggest --prefer-stable --prefer-lowest; fi
1213
1314before_script :
14- - mkdir -p ~/.phpenv/versions/$(phpenv version-name)/etc
15- - mkdir -p ~/.okta
15+ - mkdir -p ~/.phpenv/versions/$(phpenv version-name)/etc
16+ - mkdir -p ~/.okta
1617
1718script :
18- - vendor/bin/phpunit --verbose --coverage-clover build/logs/clover.xml
19+ - vendor/bin/phpunit --verbose --coverage-clover build/logs/clover.xml
1920
2021after_success :
21- - if [[ $coverage = 'true' ]]; then bash <(curl -s https://codecov.io/bash); fi
22+ - if [[ $COVERAGE = 'true' ]]; then bash <(curl -s https://codecov.io/bash); fi
23+ - if [[ $DEPLOY_DOCS ]]; then wget -O sami.phar http://get.sensiolabs.org/sami.phar; fi;
24+ - if [[ $DEPLOY_DOCS ]]; then chmod +x ./scripts/prepare-docs.sh; fi
25+ - if [[ $DEPLOY_DOCS ]]; then ./scripts/prepare-docs.sh; fi
26+
27+ deploy :
28+ provider : pages
29+ skip_cleanup : true
30+ github_token : $GITHUB_TOKEN
31+ local_dir : full/build/gh-pages
32+ email : deploy-php@okta.com
33+ name : PHP Deployment Bot
34+ on :
35+ php : 7.1
36+ tags : true
37+ branch :
38+ - develop
39+ - master
2240
2341matrix :
2442 include :
2543 - php : 7.0
26- env : setup =lowest
44+ env : SETUP =lowest
2745 - php : 7.0
28- env : setup =stable
46+ env : SETUP =stable
2947 - php : 7.1
30- env : setup =lowest
48+ env : SETUP =lowest
3149 - php : 7.1
3250 env :
33- - coverage=true
34- - setup=stable
51+ - COVERAGE=true
52+ - SETUP=stable
53+ - DEPLOY_DOCS=true
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ use Sami \Sami ;
4+ use Symfony \Component \Finder \Finder ;
5+ use Sami \Version \GitVersionCollection ;
6+ use Sami \RemoteRepository \GitHubRemoteRepository ;
7+
8+ $ dir = __DIR__ . '/src ' ;
9+
10+ $ iterator = Finder::create ()
11+ ->files ()
12+ ->name ('*.php ' )
13+ ->in ($ dir )
14+ ;
15+
16+
17+ $ versions = GitVersionCollection::create ($ dir )
18+ ->addFromTags ('* ' )
19+ ;
20+
21+ return new Sami ($ iterator , [
22+ 'title ' => 'Okta PHP SDK ' ,
23+ 'versions ' => $ versions ,
24+ 'build_dir ' => __DIR__ . '/build/gh-pages/%version% ' ,
25+ 'cache_dir ' => __DIR__ . '/build/doc_cache/%version% ' ,
26+ 'remote_repository ' => new GitHubRemoteRepository ('okta/okta-sdk-php ' , dirname ($ dir )),
27+ ]);
Original file line number Diff line number Diff line change 1+ <?php
2+ /**
3+ * Adapted from contentful.php
4+ */
5+ $ travisRepoSlug = getenv ('TRAVIS_REPO_SLUG ' );
6+ $ indexFile = $ argv [1 ];
7+
8+ $ shellOutput = shell_exec ('git tag ' );
9+ $ tags = explode ("\n" , $ shellOutput );
10+ $ tags = array_filter ($ tags , function ($ tag ) {
11+ return trim ($ tag ) !== '' ;
12+ });
13+
14+ // We remove all non-stable versions from the list as we don't want to direct the docs to them by default
15+ $ tags = array_filter ($ tags , function ($ tag ) {
16+ return strpos ($ tag , '- ' ) === false ;
17+ });
18+
19+ usort ($ tags , function ($ a , $ b ) {
20+ return version_compare ($ b , $ a );
21+ });
22+
23+ $ newestTag = $ tags [0 ];
24+ $ repoParts = explode ('/ ' , $ travisRepoSlug );
25+ $ repoOwner = $ repoParts [0 ];
26+ $ repoName = $ repoParts [1 ];
27+
28+ $ html = '<meta http-equiv="refresh" content="0; url=https://developer.okta.com/ ' . $ repoName . '/ ' . $ newestTag . '/"> ' ;
29+
30+ file_put_contents ($ indexFile , $ html );
31+
32+ echo 'Created index file redirecting to ' . $ newestTag . '. ' . "\n" ;
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+ git clone https://github.com/${TRAVIS_REPO_SLUG} .git full
3+ cd full
4+ git checkout ${TRAVIS_TAG}
5+ php ../sami.phar update sami.php
6+ git checkout ${TRAVIS_TAG}
7+ mkdir build/gh-pages/latest
8+ php scripts/create-redirector.php build/gh-pages/latest/index.html
9+ php scripts/create-redirector.php build/gh-pages/index.html
You can’t perform that action at this time.
0 commit comments