From 6b2ce4382999d671951dfec61e0e09d8f22b36f9 Mon Sep 17 00:00:00 2001 From: Yuri05 Date: Mon, 19 Feb 2024 11:41:32 +0100 Subject: [PATCH] test update dev website --- .github/workflows/CreateGitHubPagesForR.yml | 82 +++++++++++++++++++++ .github/workflows/update-dev-website.yml | 2 +- 2 files changed, 83 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/CreateGitHubPagesForR.yml diff --git a/.github/workflows/CreateGitHubPagesForR.yml b/.github/workflows/CreateGitHubPagesForR.yml new file mode 100644 index 00000000..1821fc2a --- /dev/null +++ b/.github/workflows/CreateGitHubPagesForR.yml @@ -0,0 +1,82 @@ +name: Create GitHub pages for an R package + +on: + workflow_call: + inputs: + pkgdown_mode: + required: true + type: string + enum: ['devel', 'release'] + extra_r_packages: + required: false + type: string + gh-pages-branch: + required: false + type: string + default: 'gh-pages' + +jobs: + build: + runs-on: windows-latest + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + PKGDOWN_MODE: ${{ inputs.pkgdown_mode }} + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup + uses: r-lib/actions/setup-r@v2 + with: + use-public-rspm: true + - name: Setup Pandoc + uses: r-lib/actions/setup-pandoc@v2 + - name: Install required packages + uses: r-lib/actions/setup-r-dependencies@v2 + with: + extra-packages: | + ${{ inputs.extra_r_packages }} + any::pkgdown + local::. + needs: website + - name: Remove build number from the DESCRIPTION and build site + run: | + description <- readLines('DESCRIPTION') + versionLine <- grep(pattern = 'Version: [0-9]\\.[0-9]\\.[0-9]', description) + description[versionLine] <- gsub(pattern = '\\.[0-9]$', replacement = '', description[versionLine]) + writeLines(description, 'DESCRIPTION') + options(yaml.eval.expr=TRUE) + pkgdown::build_site(devel=TRUE, install=TRUE) + shell: Rscript {0} + # The project is then uploaded as an artifact named 'docs'. + - name: Upload Artifacts + uses: actions/upload-artifact@v1 + with: + name: docs + path: docs + + deploy: + concurrency: ci-${{ github.ref }} + # The second job must depend on the first one to complete before running and uses ubuntu-latest instead of windows. + needs: [build] + runs-on: ubuntu-latest + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + steps: + - name: Checkout + uses: actions/checkout@v4 + # The built project is downloaded into the 'docs' folder. + - name: Download Artifacts + uses: actions/download-artifact@v1 + with: + name: docs + - name: Deploy + uses: JamesIves/github-pages-deploy-action@v4 + # The deployment folder should match the name of the artifact. + # Clean is false to prevent removing release site + # only target folder of repo from gh-pages branch is updated + with: + folder: docs + clean: false + branch: ${{ inputs.gh-pages-branch }} + target-folder: docs + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/update-dev-website.yml b/.github/workflows/update-dev-website.yml index 34b2aa76..4c5b4b19 100644 --- a/.github/workflows/update-dev-website.yml +++ b/.github/workflows/update-dev-website.yml @@ -11,7 +11,7 @@ permissions: jobs: update_dev_website: - uses: Yuri05/Test04/edit/main/.github/workflows/CreateGitHubPagesForR.yml@main + uses: ./CreateGitHubPagesForR.yml #Yuri05/Test04/edit/main/.github/workflows/CreateGitHubPagesForR.yml@main with: pkgdown_mode: 'devel' extra_r_packages: 'github::Open-Systems-Pharmacology/OSPSuite.RUtils'