@@ -17,6 +17,16 @@ parameters:
1717 default : false
1818
1919commands :
20+ install-linux-mbx-ci :
21+ steps :
22+ - run :
23+ name : " Install mbx-ci"
24+ command : |
25+ mkdir -p ./bin
26+ curl -fsSL https://mapbox-release-engineering.s3.amazonaws.com/mbx-ci/latest/mbx-ci-linux-amd64 > mbx-ci
27+ sudo mv mbx-ci /usr/local/bin/
28+ chmod 755 /usr/local/bin/mbx-ci
29+ echo "mbx-ci version: $(mbx-ci --version)"
2030 install-mbx-ci :
2131 steps :
2232 - macos/install-rosetta
@@ -25,6 +35,14 @@ commands:
2535 command : |
2636 curl -Ls https://mapbox-release-engineering.s3.amazonaws.com/mbx-ci/latest/mbx-ci-darwin-amd64 > /usr/local/bin/mbx-ci
2737 chmod 755 /usr/local/bin/mbx-ci
38+ install-linux-s5cmd :
39+ steps :
40+ - run :
41+ name : " Install s5cmd"
42+ command : |
43+ curl -fsSL https://github.com/peak/s5cmd/releases/download/v2.3.0/s5cmd_2.3.0_Linux-64bit.tar.gz | tar xvz
44+ sudo mv s5cmd /usr/local/bin/
45+ echo "s5cmd version: $(s5cmd version)"
2846 notify-build-finished :
2947 parameters :
3048 notify_success :
@@ -695,46 +713,79 @@ jobs:
695713 default : " 14.3.1"
696714 macos :
697715 xcode : << parameters.xcode >>
716+ resource_class : m4pro.medium
698717 environment :
699718 HOMEBREW_NO_AUTO_UPDATE : 1
700- resource_class : m4pro.medium
701719 steps :
702720 - checkout
703721 - *restore-cache-gems
704- - *restore-cache-podmaster
705722 - *install-gems
706723 - *prepare-netrc-file
707724 - *add-github-to-known-hosts
708- - install-mbx-ci
709725 - run :
710726 name : Generate docs
711727 command : |
712- OUTPUT=$( echo << pipeline.git.tag >> | sed 's/^v//' )
713- export OUTPUT="${OUTPUT:-documentation}"
714- echo "export OUTPUT=$OUTPUT" >> $BASH_ENV
715- ./scripts/document.sh
716- cp -a "$OUTPUT" /tmp/generated-docs
717- - *save-cache-podmaster
728+ TAG="<< pipeline.git.tag >>"
729+ if [ -n "$TAG" ]; then
730+ VERSION=${TAG#v}
731+ else
732+ # Dummy version for non-tagged builds.
733+ VERSION=0.0.0
734+ fi
735+ OUTPUT_PATH="build/docs/$VERSION"
736+ echo "export OUTPUT_PATH=$OUTPUT_PATH" >> $BASH_ENV
737+ ./scripts/generate-docs.sh "$VERSION" "$OUTPUT_PATH"
718738 - *save-cache-gems
739+ - persist_to_workspace :
740+ root : ./
741+ paths :
742+ - build/docs
719743 - run :
720- name : Compress Docs
721- command : tar -cvzf /tmp/docs.tar /tmp/generated-docs
744+ name : Compress docs
745+ command : |
746+ mkdir -p build/archives
747+ tar -cvzf build/archives/navsdk-v2-docs.tar $OUTPUT_PATH
722748 - store_artifacts :
723- path : /tmp/docs.tar
724- destination : docs
749+ path : build/archives/navsdk-v2-docs.tar
750+ destination : navsdk-v2-docs
751+ - notify-build-finished
752+
753+ publish-docs-job :
754+ docker :
755+ - image : cimg/base:current
756+ resource_class : small
757+ environment :
758+ HOMEBREW_NO_AUTO_UPDATE : 1
759+ MBX_CI_DOMAIN : o619qyc20d.execute-api.us-east-1.amazonaws.com
760+ TARGET_ENVIRONMENT : docs.mapbox.com
761+ steps :
725762 - when :
726- condition : << pipeline.git.tag >>
763+ condition : << pipeline.git.tag >> =~ /^v2\.\d+\.\d+(-.+)?$/
727764 steps :
728- - run :
729- name : Push docs to publisher-production
730- command : |
731- git remote set-url origin "https://x-access-token:$(mbx-ci github writer public token)@github.com/mapbox/mapbox-navigation-ios.git"
732- git config user.email "[email protected] " 733- git config user.name "Mapbox Releases"
734- VERSION="${OUTPUT}" scripts/publish-docs.sh
735- - notify-build-finished :
736- notify_success : true
737- - notify-build-finished
765+ - checkout
766+ - *add-github-to-known-hosts
767+ - attach_workspace :
768+ at : .
769+ - install-linux-mbx-ci
770+ - install-linux-s5cmd
771+ - run :
772+ name : Publish docs
773+ command : |
774+ TAG="<< pipeline.git.tag >>"
775+ if [ -z "$TAG" ]; then
776+ echo "ERROR: Missing git tag. A tag is required to publish documentation."
777+ exit 1
778+ fi
779+ VERSION=${TAG#v}
780+
781+ if ! mbx-ci aws setup; then
782+ echo "ERROR: Could not setup AWS credentials."
783+ exit 1
784+ fi
785+
786+ SOURCE_PATH="build/docs/$VERSION"
787+ ./scripts/publish-docs.sh "$VERSION" "$TARGET_ENVIRONMENT" "$SOURCE_PATH"
788+ - notify-build-finished
738789
739790 update-version-job :
740791 parameters :
@@ -946,11 +997,21 @@ workflows:
946997 clean_build : false
947998 context : Slack Orb
948999 - generate-docs-job :
949- name : Generate / Publish Documentation
1000+ name : Generate Documentation
9501001 context : Slack Orb
9511002 filters :
9521003 tags :
953- only : /^v\d+\.\d+\.\d+(-.+)?$/
1004+ only : /^v2\.\d+\.\d+(-.+)?$/
1005+ - publish-docs-job :
1006+ name : Publish Documentation
1007+ context : Slack Orb
1008+ requires :
1009+ - Generate Documentation
1010+ filters :
1011+ branches :
1012+ ignore : /.*/
1013+ tags :
1014+ only : /^v2\.\d+\.\d+(-.+)?$/
9541015 - ios-trigger-metrics :
9551016 filters :
9561017 branches :
0 commit comments