From f36544c08f1f0b85a6b98b71cc5acae7ec0c8cf0 Mon Sep 17 00:00:00 2001 From: Matthew Phelps Date: Mon, 18 Mar 2024 15:00:46 +0100 Subject: [PATCH 1/3] Feature/depl_website (#5) * Try to get website deployed * Test if using usethis::use_pkgdown_github_pages() worked --- .Rbuildignore | 5 +++ .github/workflows/Release-package.yaml | 22 ++++++++++++ .github/workflows/pkgdown.yaml | 48 ++++++++++++++++++++++++++ .gitignore | 1 + DESCRIPTION | 1 + _pkgdown.yml | 28 ++++----------- 6 files changed, 84 insertions(+), 21 deletions(-) create mode 100644 .github/workflows/Release-package.yaml create mode 100644 .github/workflows/pkgdown.yaml diff --git a/.Rbuildignore b/.Rbuildignore index 003509f..7fa3ec9 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -8,3 +8,8 @@ ^.github ^.githooks ^.pre-commit-config.yaml +RELEASE_BODY\.txt +^\.github$ +^_pkgdown\.yml$ +^docs$ +^pkgdown$ diff --git a/.github/workflows/Release-package.yaml b/.github/workflows/Release-package.yaml new file mode 100644 index 0000000..260b16a --- /dev/null +++ b/.github/workflows/Release-package.yaml @@ -0,0 +1,22 @@ + on: + push: + branches: main + pull_request: + branches: main + workflow_dispatch: + + name: Release Package + + jobs: + build: + name: RMD Build and check + uses: ./.github/workflows/R-CMD-check.yaml + docs: + needs: build + name: Build and Deploy Docs + uses: ./.github/workflows/pkgdown.yaml + release: + needs: [build, docs] + name: Release + if: github.event_name != 'pull_request' + uses: ./.github/workflows/release.yaml \ No newline at end of file diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml new file mode 100644 index 0000000..a7276e8 --- /dev/null +++ b/.github/workflows/pkgdown.yaml @@ -0,0 +1,48 @@ +# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples +# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help +on: + push: + branches: [main, master] + pull_request: + branches: [main, master] + release: + types: [published] + workflow_dispatch: + +name: pkgdown + +jobs: + pkgdown: + runs-on: ubuntu-latest + # Only restrict concurrency for non-PR jobs + concurrency: + group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }} + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + permissions: + contents: write + steps: + - uses: actions/checkout@v4 + + - uses: r-lib/actions/setup-pandoc@v2 + + - uses: r-lib/actions/setup-r@v2 + with: + use-public-rspm: true + + - uses: r-lib/actions/setup-r-dependencies@v2 + with: + extra-packages: any::pkgdown, local::. + needs: website + + - name: Build site + run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE) + shell: Rscript {0} + + - name: Deploy to GitHub pages 🚀 + if: github.event_name != 'pull_request' + uses: JamesIves/github-pages-deploy-action@v4.5.0 + with: + clean: false + branch: gh-pages + folder: docs diff --git a/.gitignore b/.gitignore index 268ae55..3e202f3 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ inst/doc docs/ launch.json .Rhistory +docs diff --git a/DESCRIPTION b/DESCRIPTION index 427d467..457cc89 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -33,3 +33,4 @@ Remotes: hta-pharma/chefCriteria, matthew-phelps/testr VignetteBuilder: knitr +URL: https://hta-pharma.github.io/ramnog/ diff --git a/_pkgdown.yml b/_pkgdown.yml index b9ad023..ef8c868 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -1,16 +1,10 @@ -url: ~ +url: https://hta-pharma.github.io/ramnog/ template: bootstrap: 5 - - - articles: - - title: Overview navbar: Overview - contents: - - ep_overview - + contents: ep_overview - title: Endpoint Population and Outcome Specification navbar: Endpoint Population and Outcome Specification contents: @@ -20,29 +14,21 @@ articles: - ep_spec_event_def - ep_spec_strata_def - ep_spec_label - - title: Endpoint Statistics navbar: Endpoint Statistics - contents: - - starts_with('methods_') - + contents: starts_with('methods_') - title: Endpoint Results navbar: Endpoint Results - contents: - - starts_with("results") - + contents: starts_with("results") - title: Endpoint Examples navbar: Endpoint Examples - contents: - - starts_with("example_") - + contents: starts_with("example_") - title: Debugging navbar: Debugging - contents: - - debugging - + contents: debugging - title: Development navbar: Development contents: - starts_with("dev") - validation + From 3e4118fa10cbe1e345f44099f80eb9c072ce1120 Mon Sep 17 00:00:00 2001 From: Matthew Phelps Date: Mon, 18 Mar 2024 15:30:34 +0100 Subject: [PATCH 2/3] Bug/fix_pages (#7) * Remove workflow that should not have been included * Updating pkgdown yaml to try and get it to publish --- .github/workflows/Release-package.yaml | 22 ---------------- .github/workflows/pkgdown.yaml | 36 ++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 22 deletions(-) delete mode 100644 .github/workflows/Release-package.yaml diff --git a/.github/workflows/Release-package.yaml b/.github/workflows/Release-package.yaml deleted file mode 100644 index 260b16a..0000000 --- a/.github/workflows/Release-package.yaml +++ /dev/null @@ -1,22 +0,0 @@ - on: - push: - branches: main - pull_request: - branches: main - workflow_dispatch: - - name: Release Package - - jobs: - build: - name: RMD Build and check - uses: ./.github/workflows/R-CMD-check.yaml - docs: - needs: build - name: Build and Deploy Docs - uses: ./.github/workflows/pkgdown.yaml - release: - needs: [build, docs] - name: Release - if: github.event_name != 'pull_request' - uses: ./.github/workflows/release.yaml \ No newline at end of file diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml index a7276e8..8b951ee 100644 --- a/.github/workflows/pkgdown.yaml +++ b/.github/workflows/pkgdown.yaml @@ -39,6 +39,7 @@ jobs: run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE) shell: Rscript {0} +# If not pull request a brand new webpage is deployed - name: Deploy to GitHub pages 🚀 if: github.event_name != 'pull_request' uses: JamesIves/github-pages-deploy-action@v4.5.0 @@ -46,3 +47,38 @@ jobs: clean: false branch: gh-pages folder: docs + + # If pull request the webpage is deployed inside a dev/"PR number" folder for review + + - name: Add pkgdown PR Comment + uses: marocchino/sticky-pull-request-comment@v2 + if: github.event_name == 'pull_request' + with: + recreate: true + header: pkgdown + message: | + # Github pages + Review the pkgdown webpage for the PR [here](https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/dev/${{ github.event.pull_request.number }}) + + - name: Copy page to temp folder + if: github.event_name == 'pull_request' + run: | + mkdir -p /home/runner/work/dev + cp -r ./docs/* /home/runner/work/dev + + - name: Check out gh-pages branch + if: github.event_name == 'pull_request' + uses: actions/checkout@v4 + with: + ref: gh-pages + + - name: Copy and push to gh-pages + if: github.event_name == 'pull_request' + run: | + mkdir -p dev/${{ github.event.pull_request.number }} + cp -r /home/runner/work/dev/* ./dev/${{ github.event.pull_request.number }} + git config --global user.email "actions-robot@novonordisk.com" + git config --global user.name "Actions Robot From Github Actions" + git add . + git commit -m "Update gh pages from the PR" + git push \ No newline at end of file From 9c7247e1d988f0090f27ca7c8d3466bb1c046bba Mon Sep 17 00:00:00 2001 From: Matthew Phelps Date: Mon, 18 Mar 2024 15:59:29 +0100 Subject: [PATCH 3/3] Trying to get github pages working --- .github/workflows/pkgdown.yaml | 37 +--------------------------------- 1 file changed, 1 insertion(+), 36 deletions(-) diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml index 8b951ee..ac85d16 100644 --- a/.github/workflows/pkgdown.yaml +++ b/.github/workflows/pkgdown.yaml @@ -4,7 +4,7 @@ on: push: branches: [main, master] pull_request: - branches: [main, master] + branches: [main, master, dev] release: types: [published] workflow_dispatch: @@ -39,7 +39,6 @@ jobs: run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE) shell: Rscript {0} -# If not pull request a brand new webpage is deployed - name: Deploy to GitHub pages 🚀 if: github.event_name != 'pull_request' uses: JamesIves/github-pages-deploy-action@v4.5.0 @@ -48,37 +47,3 @@ jobs: branch: gh-pages folder: docs - # If pull request the webpage is deployed inside a dev/"PR number" folder for review - - - name: Add pkgdown PR Comment - uses: marocchino/sticky-pull-request-comment@v2 - if: github.event_name == 'pull_request' - with: - recreate: true - header: pkgdown - message: | - # Github pages - Review the pkgdown webpage for the PR [here](https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/dev/${{ github.event.pull_request.number }}) - - - name: Copy page to temp folder - if: github.event_name == 'pull_request' - run: | - mkdir -p /home/runner/work/dev - cp -r ./docs/* /home/runner/work/dev - - - name: Check out gh-pages branch - if: github.event_name == 'pull_request' - uses: actions/checkout@v4 - with: - ref: gh-pages - - - name: Copy and push to gh-pages - if: github.event_name == 'pull_request' - run: | - mkdir -p dev/${{ github.event.pull_request.number }} - cp -r /home/runner/work/dev/* ./dev/${{ github.event.pull_request.number }} - git config --global user.email "actions-robot@novonordisk.com" - git config --global user.name "Actions Robot From Github Actions" - git add . - git commit -m "Update gh pages from the PR" - git push \ No newline at end of file