From 3579d90b60b413ed546c1a8956bae5cfe5c07ef7 Mon Sep 17 00:00:00 2001 From: Erik Date: Wed, 12 Jun 2024 09:35:40 -0700 Subject: [PATCH 1/5] add workflow --- .github/workflows/pages.yml | 62 +++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 .github/workflows/pages.yml diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml new file mode 100644 index 000000000..bd9959e3e --- /dev/null +++ b/.github/workflows/pages.yml @@ -0,0 +1,62 @@ +name: Deploy gh-pages + +on: + push: + branches: ["master"] + + workflow_dispatch: + +permissions: + contents: read + pages: write + id-token: write + +concurrency: + group: "pages" + cancel-in-progress: false + +jobs: + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Build docs + working-directory: r-package/grf + run: | + # Install pandoc + sudo apt-get install -qq pandoc + + # Install R + curl -OLs https://eddelbuettel.github.io/r-ci/run.sh && chmod 0755 run.sh + ./run.sh bootstrap + ./run.sh install_all + + # Install grf + R CMD INSTALL . + + # Use pkgdown v1.5 + sudo Rscript -e "install.packages(c('fs', 'highlight', 'httr', 'memoise', 'openssl', 'purrr', 'rmarkdown', 'rstudioapi', 'whisker', 'xml2', 'yaml'))" + sudo Rscript -e "install.packages('https://cran.r-project.org/src/contrib/Archive/pkgdown/pkgdown_1.5.1.tar.gz', repos = NULL, type = 'source')" + + # Install packages used in vignettes + sudo Rscript -e "install.packages(c('glmnet', 'maq', 'policytree'))" + + # Build site + cp ../../README.md . + cp ../../REFERENCE.md . + cp ../../DEVELOPING.md . + cp ../../releases/CHANGELOG.md . + Rscript -e "pkgdown::build_site()" + - name: Setup Pages + uses: actions/configure-pages@v5 + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: 'r-package/grf/docs' + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 From 6d98bce545185ab130479030544a948a6e89f147 Mon Sep 17 00:00:00 2001 From: Erik Date: Wed, 12 Jun 2024 09:36:38 -0700 Subject: [PATCH 2/5] remove pipeline --- azure-pipelines.yml | 34 ---------------------------------- 1 file changed, 34 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 79e992761..eee10dca2 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -106,37 +106,3 @@ jobs: workingDirectory: r-package/grf displayName: Valgrind check condition: eq(variables['Agent.OS'], 'Linux') - # Final deploy step: - # Build the online docs and deploy to gh-pages - only done on master branch with Linux image. - # `GITHUB_PAT` is a GitHub access token stored on Azure Pipelines. - - script: | - set -e - sudo apt-get install -qq pandoc - # Lock in a previous version of `pkgdown` and its dependencies. - sudo Rscript -e "install.packages(c('fs', 'highlight', 'httr', 'memoise', 'openssl', 'purrr', 'rmarkdown', 'rstudioapi', 'whisker', 'xml2', 'yaml'))" - sudo Rscript -e "install.packages('https://cran.r-project.org/src/contrib/Archive/pkgdown/pkgdown_1.5.1.tar.gz', repos = NULL, type = 'source')" - # Install dependencies needed for vignettes. - sudo Rscript -e "install.packages(c('DiagrammeR', 'ggplot2', 'glmnet', 'maq', 'policytree', 'rdd'))" - cp ../../README.md . - cp ../../REFERENCE.md . - cp ../../DEVELOPING.md . - cp ../../releases/CHANGELOG.md . - # Build and deploy page. This requires that the branch `gh-pages` exists. - # git worktree is used to only commit the doc folder (docs/) as the root. - # update-ref is used to not keep a commit history of the generated docs. - git config --local user.email "azuredevops@microsoft.com" - git config --local user.name "Azure Pipelines" - git worktree add -B gh-pages docs/ origin/gh-pages - rm -rf docs/* - Rscript -e "pkgdown::build_site()" - cd docs - git add --all - git update-ref -d refs/heads/gh-pages - git commit --allow-empty -m "Update gh-pages ***NO_CI***" - git push --force https://$(GITHUB_PAT)@github.com/grf-labs/grf.git HEAD:gh-pages - workingDirectory: r-package/grf - displayName: 'Publish GitHub Pages' - condition: | - and(eq(variables['Agent.OS'], 'Linux'), - and(not(eq(variables['Build.Reason'], 'PullRequest')), - eq(variables['Build.SourceBranch'], 'refs/heads/master'))) From 2dc7bee2aee63d840ea0085762d3100b9896dc2e Mon Sep 17 00:00:00 2001 From: Erik Date: Wed, 12 Jun 2024 09:37:47 -0700 Subject: [PATCH 3/5] to revert --- .github/workflows/pages.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index bd9959e3e..322cff227 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -3,6 +3,8 @@ name: Deploy gh-pages on: push: branches: ["master"] + pull_request: + branches: master workflow_dispatch: From 08d03d3f6a8ee10cd0c570572b86925dc78af688 Mon Sep 17 00:00:00 2001 From: Erik Date: Wed, 12 Jun 2024 09:56:30 -0700 Subject: [PATCH 4/5] wp --- .github/workflows/pages.yml | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 322cff227..be063cb58 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -26,7 +26,7 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - - name: Build docs + - name: Setup build working-directory: r-package/grf run: | # Install pandoc @@ -39,14 +39,18 @@ jobs: # Install grf R CMD INSTALL . - - # Use pkgdown v1.5 + - name: Setup docs + working-directory: r-package/grf + run: | + # Install pkgdown v1.5 sudo Rscript -e "install.packages(c('fs', 'highlight', 'httr', 'memoise', 'openssl', 'purrr', 'rmarkdown', 'rstudioapi', 'whisker', 'xml2', 'yaml'))" sudo Rscript -e "install.packages('https://cran.r-project.org/src/contrib/Archive/pkgdown/pkgdown_1.5.1.tar.gz', repos = NULL, type = 'source')" # Install packages used in vignettes - sudo Rscript -e "install.packages(c('glmnet', 'maq', 'policytree'))" - + sudo Rscript -e "install.packages(c('ggplot2', 'glmnet', 'maq', 'policytree'))" + - name: Build docs + working-directory: r-package/grf + run: | # Build site cp ../../README.md . cp ../../REFERENCE.md . From 75d9c72765f223869c19fa4888fc1db64d2ee0bd Mon Sep 17 00:00:00 2001 From: Erik Date: Wed, 12 Jun 2024 10:23:33 -0700 Subject: [PATCH 5/5] Revert "to revert" This reverts commit 2dc7bee2aee63d840ea0085762d3100b9896dc2e. --- .github/workflows/pages.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index be063cb58..aa63ffbc1 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -3,8 +3,6 @@ name: Deploy gh-pages on: push: branches: ["master"] - pull_request: - branches: master workflow_dispatch: