diff --git a/.github/workflows/scala3doc.yaml b/.github/workflows/scala3doc.yaml index bf7ecc10882d..0c3c8ef7fc73 100644 --- a/.github/workflows/scala3doc.yaml +++ b/.github/workflows/scala3doc.yaml @@ -4,16 +4,28 @@ on: push: branches: - master - pull_request: + pull_request_target: jobs: build: runs-on: ubuntu-latest - container: lampepfl/dotty:2020-04-24 steps: - name: Git Checkout uses: actions/checkout@v2 + - name: Checkout to PR code + env: + PR_NUMBER: ${{ github.event.pull_request.number }} + run : | + if [[ -z "${PR_NUMBER}" ]]; then + echo Not a pull request do not need to checkout + else + REF=refs/pull/$PR_NUMBER/merge + echo checking $REF + git fetch origin $REF:$REF + git checkout $REF + fi + - name: Cache Coursier uses: actions/cache@v1 with: @@ -44,3 +56,15 @@ jobs: - name: Generate documentation for example project using dotty-sbt run: ./project/scripts/sbt "sbt-dotty/scripted sbt-dotty/scala3doc" + + - name: Upload documentation to server + uses: azure/CLI@v1 + env: + AZURE_STORAGE_SAS_TOKEN: ${{ secrets.AZURE_STORAGE_SAS_TOKEN }} + PR_NUMBER: ${{ github.event.pull_request.number }} + with: + inlineScript: | + DOC_DEST=pr-$PR_NUMBER + echo uplading docs to https://scala3doc.virtuslab.com/$DOC_DEST + az storage container create --name $DOC_DEST --account-name scala3docstorage --public-access container + az storage blob sync -s scala3doc/output -c $DOC_DEST --account-name scala3docstorage diff --git a/scala3doc/README.md b/scala3doc/README.md index b2ee48d8bb8b..4819a9021698 100644 --- a/scala3doc/README.md +++ b/scala3doc/README.md @@ -60,16 +60,18 @@ work on the project. For every PR, we build documentation for Scala3doc and Dotty. For example, for PR 123 you can find them at: -- -- +- +- +- Note that these correspond to the contents of `output` directory - that's precisely what they are. You can also find the result of building the same sites for latest `master` at: -- -- +- +- +- ### Testing