From a5de8ebc960beada70a495e7c605615ca5bf1001 Mon Sep 17 00:00:00 2001 From: Aaron Peikert Date: Fri, 1 Jul 2022 11:59:29 +0200 Subject: [PATCH 1/2] preview documentation PRs --- .github/workflows/preview-documentation.yml | 39 +++++++++++++++++++++ docs/make.jl | 4 +-- 2 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/preview-documentation.yml diff --git a/.github/workflows/preview-documentation.yml b/.github/workflows/preview-documentation.yml new file mode 100644 index 000000000..9bc3297fd --- /dev/null +++ b/.github/workflows/preview-documentation.yml @@ -0,0 +1,39 @@ +name: Preview Documentation + +on: + pull_request: + types: [opened, synchronize] + +env: + PR_NUMBER: ${{ github.event.pull_request.number }} + GHP_URL: 'https://structuralequationmodels.github.io/StructuralEquationModels.jl/' + +jobs: + build: + if: startsWith(github.head_ref, 'documentation/') + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: julia-actions/setup-julia@latest + with: + version: '1.6' + - name: Install dependencies + run: julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()' + - name: Build and deploy + id: deploy + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # If authenticating with GitHub Actions token + DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} # If authenticating with SSH deploy key + run: julia --project=docs/ docs/make.jl push_preview=true + + - uses: actions/github-script@v5 + if: steps.deploy.outcome == 'success' + with: + github-token: ${{secrets.GITHUB_TOKEN}} + script: | + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: 'Docs can be previewed here: ${{ env.GHP_URL }}previews/PR${{ env.PR_NUMBER }}' + }) \ No newline at end of file diff --git a/docs/make.jl b/docs/make.jl index 56d46d6ee..f6ff2994c 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -72,5 +72,5 @@ makedocs( deploydocs( repo = "github.com/StructuralEquationModels/StructuralEquationModels.jl", - devbranch = "devel" -) \ No newline at end of file + push_preview = "push_preview=true" ∈ ARGS +) From 5bc5fc426a9896b40527b690224fb85843417ac5 Mon Sep 17 00:00:00 2001 From: Aaron Peikert Date: Fri, 1 Jul 2022 12:04:36 +0200 Subject: [PATCH 2/2] forgot devbranch --- docs/make.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/make.jl b/docs/make.jl index f6ff2994c..d26e4532b 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -72,5 +72,6 @@ makedocs( deploydocs( repo = "github.com/StructuralEquationModels/StructuralEquationModels.jl", + devbranch = "devel", push_preview = "push_preview=true" ∈ ARGS )