From 005b4ccc45c35e1460a8732a36e2888134587cb3 Mon Sep 17 00:00:00 2001 From: Chris Hansen Date: Mon, 26 Feb 2024 22:17:59 -0500 Subject: [PATCH 1/5] Add website CI build with artifacts for pull requests --- .github/workflows/website.yaml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/website.yaml b/.github/workflows/website.yaml index b959c0f..136a169 100644 --- a/.github/workflows/website.yaml +++ b/.github/workflows/website.yaml @@ -5,6 +5,8 @@ on: # Runs on pushes targeting the default branch push: branches: ["gh-pages"] + pull_request: + types: [opened, reopened, synchronize] # Allows you to run this workflow manually from the Actions tab workflow_dispatch: @@ -61,12 +63,22 @@ jobs: chmod -c -R +rX "_site/" | while read line; do echo "::warning title=Invalid file permissions automatically fixed::$line" done + + - name: Upload actions artifact + if: github.event_name == 'pull_request' + uses: actions/upload-artifact@v4 + with: + name: pull_${{ github.event.pull_request.number }}-website + path: _site/ + overwrite: true - - name: Upload artifact + - name: Upload pages artifact + if: github.event_name != 'pull_request' uses: actions/upload-pages-artifact@v3 # Deployment job deploy: + if: github.event_name != 'pull_request' environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} From b4527a5b28e4d6c1c992db9677f5488de125b0ca Mon Sep 17 00:00:00 2001 From: Chris Hansen Date: Mon, 26 Feb 2024 22:33:21 -0500 Subject: [PATCH 2/5] Add step to post PR comment pointing to artifact --- .github/workflows/website.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/website.yaml b/.github/workflows/website.yaml index 136a169..b651d2e 100644 --- a/.github/workflows/website.yaml +++ b/.github/workflows/website.yaml @@ -67,11 +67,19 @@ jobs: - name: Upload actions artifact if: github.event_name == 'pull_request' uses: actions/upload-artifact@v4 + id: artifact-upload-step with: name: pull_${{ github.event.pull_request.number }}-website path: _site/ overwrite: true + - name: Add artifact to PR + if: github.event_name == 'pull_request' + uses: thollander/actions-comment-pull-request@v2 + with: + message: | + An updated build of the documentation for this PR has been completed :incoming_envelope:. It can be accessed at ${{ steps.artifact-upload-step.outputs.artifact-url }}. + - name: Upload pages artifact if: github.event_name != 'pull_request' uses: actions/upload-pages-artifact@v3 From 56b30059bf6cab15e39b92c147e38fc463b1b6c5 Mon Sep 17 00:00:00 2001 From: Chris Hansen Date: Mon, 26 Feb 2024 22:40:36 -0500 Subject: [PATCH 3/5] Revert last commit --- .github/workflows/website.yaml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.github/workflows/website.yaml b/.github/workflows/website.yaml index b651d2e..136a169 100644 --- a/.github/workflows/website.yaml +++ b/.github/workflows/website.yaml @@ -67,19 +67,11 @@ jobs: - name: Upload actions artifact if: github.event_name == 'pull_request' uses: actions/upload-artifact@v4 - id: artifact-upload-step with: name: pull_${{ github.event.pull_request.number }}-website path: _site/ overwrite: true - - name: Add artifact to PR - if: github.event_name == 'pull_request' - uses: thollander/actions-comment-pull-request@v2 - with: - message: | - An updated build of the documentation for this PR has been completed :incoming_envelope:. It can be accessed at ${{ steps.artifact-upload-step.outputs.artifact-url }}. - - name: Upload pages artifact if: github.event_name != 'pull_request' uses: actions/upload-pages-artifact@v3 From d85558e03c239f0042283622cc7edeff5f98fd67 Mon Sep 17 00:00:00 2001 From: Chris Hansen Date: Mon, 26 Feb 2024 23:23:27 -0500 Subject: [PATCH 4/5] Add build to main for nightly documentation --- .github/workflows/website.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/website.yaml b/.github/workflows/website.yaml index 136a169..d938a16 100644 --- a/.github/workflows/website.yaml +++ b/.github/workflows/website.yaml @@ -2,9 +2,9 @@ name: Build and deploy OFT website using GitHub Pages on: - # Runs on pushes targeting the default branch + # Runs on pushes targeting main or gh-pages branch (deploy on gh-pages only) push: - branches: ["gh-pages"] + branches: ["gh-pages", "main"] pull_request: types: [opened, reopened, synchronize] @@ -78,7 +78,7 @@ jobs: # Deployment job deploy: - if: github.event_name != 'pull_request' + if: github.ref == 'ref/head/gh-pages' environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} From 80a5ebd7a76d6de53f9e6012f9d30a861cc74547 Mon Sep 17 00:00:00 2001 From: Chris Hansen Date: Mon, 26 Feb 2024 23:29:32 -0500 Subject: [PATCH 5/5] Update build style for pull requests and main branch --- .github/workflows/website.yaml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/website.yaml b/.github/workflows/website.yaml index d938a16..1eb2c22 100644 --- a/.github/workflows/website.yaml +++ b/.github/workflows/website.yaml @@ -43,7 +43,14 @@ jobs: - name: Create build dir run: mkdir build_docs - - name: Configure OFT documentation + - name: Configure OFT documentation (nightly) + if: github.ref != 'ref/head/gh-pages' + shell: bash + working-directory: build_docs + run: cmake -DOFT_BUILD_DOCS:BOOL=ON -DOFT_DOCS_ONLY:BOOL=ON -DOFT_PACKAGE_NIGHTLY:BOOL=ON ../src + + - name: Configure OFT documentation (deploy) + if: github.ref == 'ref/head/gh-pages' shell: bash working-directory: build_docs run: cmake -DOFT_BUILD_DOCS:BOOL=ON -DOFT_DOCS_ONLY:BOOL=ON -DOFT_PACKAGE_NIGHTLY:BOOL=OFF ../src @@ -65,7 +72,7 @@ jobs: done - name: Upload actions artifact - if: github.event_name == 'pull_request' + if: github.ref != 'ref/head/gh-pages' uses: actions/upload-artifact@v4 with: name: pull_${{ github.event.pull_request.number }}-website @@ -73,7 +80,7 @@ jobs: overwrite: true - name: Upload pages artifact - if: github.event_name != 'pull_request' + if: github.ref == 'ref/head/gh-pages' uses: actions/upload-pages-artifact@v3 # Deployment job