@@ -529,13 +529,10 @@ build-macos-subkey:
529
529
tags :
530
530
- osx
531
531
532
- build-rust-doc :
532
+ build-rustdoc :
533
533
stage : build
534
534
<< : *docker-env
535
535
<< : *test-refs
536
- needs :
537
- - job : test-linux-stable
538
- artifacts : false
539
536
variables :
540
537
<< : *default-vars
541
538
SKIP_WASM_BUILD : 1
@@ -546,13 +543,15 @@ build-rust-doc:
546
543
paths :
547
544
- ./crate-docs/
548
545
script :
546
+ # FIXME: it fails with `RUSTDOCFLAGS="-Dwarnings"`
549
547
- RUSTDOCFLAGS="--html-in-header $(pwd)/.maintain/rustdoc-header.html"
550
548
time cargo +nightly doc --no-deps --workspace --all-features --verbose
551
549
- rm -f ./target/doc/.lock
552
550
- mv ./target/doc ./crate-docs
551
+ # FIXME: remove me after CI image gets nonroot
552
+ - chown -R nonroot:nonroot ./crate-docs
553
553
- echo "<meta http-equiv=refresh content=0;url=sc_service/index.html>" > ./crate-docs/index.html
554
554
- sccache -s
555
- allow_failure : true
556
555
557
556
# ### stage: publish
558
557
@@ -641,32 +640,49 @@ publish-s3-release:
641
640
- aws s3 ls s3://${BUCKET}/${PREFIX}/latest/
642
641
--recursive --human-readable --summarize
643
642
644
- publish-s3-doc :
643
+ publish-rustdoc :
645
644
stage : publish
646
- image : paritytech/awscli:latest
647
- allow_failure : true
648
- needs :
649
- - job : build-rust-doc
650
- artifacts : true
651
- - job : build-linux-substrate
652
- artifacts : false
653
- << : *build-refs
654
645
<< : *kubernetes-env
646
+ image : paritytech/tools:latest
655
647
variables :
656
- GIT_STRATEGY : none
657
- BUCKET : " releases.parity.io"
658
- PREFIX : " substrate-rustdoc"
659
- script :
660
- - test -r ./crate-docs/index.html || (
661
- echo "./crate-docs/index.html not present, build:rust:doc:release job not complete";
662
- exit 1
663
- )
664
- - ls -lah crate-docs
665
- - aws s3 sync --delete --size-only --only-show-errors
666
- ./crate-docs/ s3://${BUCKET}/${PREFIX}/
648
+ GIT_DEPTH : 100
649
+ rules :
650
+ - if : $CI_PIPELINE_SOURCE == "pipeline"
651
+ when : never
652
+ - if : $CI_PIPELINE_SOURCE == "web" && $CI_COMMIT_REF_NAME == "master"
653
+ - if : $CI_COMMIT_REF_NAME == "master"
654
+ # `needs:` can be removed after CI image gets nonroot. In this case `needs:` stops other
655
+ # artifacts from being dowloaded by this job.
656
+ needs :
657
+ - job : build-rustdoc
658
+ artifacts : true
659
+ script :
660
+ - rm -rf /tmp/*
661
+ # Set git config
662
+ - rm -rf .git/config
663
+ - git config user.email "devops-team@parity.io"
664
+ - git config user.name "${GITHUB_USER}"
665
+ - git config remote.origin.url "https://${GITHUB_TOKEN}@github.com/paritytech/substrate.git"
666
+ - git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
667
+ - git fetch origin gh-pages
668
+ # Save README and docs
669
+ - cp -r ./crate-docs/ /tmp/doc/
670
+ - cp README.md /tmp/doc/
671
+ - git checkout gh-pages
672
+ # Remove everything and restore generated docs and README
673
+ - rm -rf ./*
674
+ - mv /tmp/doc/* .
675
+ # Upload files
676
+ - git add --all --force
677
+ # `git commit` has an exit code of > 0 if there is nothing to commit.
678
+ # This causes GitLab to exit immediately and marks this job failed.
679
+ # We don't want to mark the entire job failed if there's nothing to
680
+ # publish though, hence the `|| true`.
681
+ - git commit -m "Updated docs for ${CI_COMMIT_REF_NAME}" ||
682
+ echo "___Nothing to commit___"
683
+ - git push origin gh-pages --force
667
684
after_script :
668
- - aws s3 ls s3://${BUCKET}/${PREFIX}/
669
- --human-readable --summarize
685
+ - rm -rf .git/ ./*
670
686
671
687
publish-draft-release :
672
688
stage : publish
0 commit comments