Skip to content

Commit 17f5086

Browse files
committed
Improve GH pages deployment
This means that the docs website is now only deployed to GH pages if/when building it actually yielded changes, not every time. This prevents waste by avoiding unneeded deployments.
1 parent 454d1cc commit 17f5086

1 file changed

Lines changed: 30 additions & 2 deletions

File tree

.github/workflows/releaseBuild.yml

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ jobs:
151151
name: Publish packages to GitHub
152152
runs-on: ubuntu-slim
153153
needs: build_and_pack
154-
if: ${{ github.event_name != 'pull_request' && github.ref_name == 'master' }}
154+
if: ${{ github.event_name == 'workflow_run' && github.ref_name == 'master' }}
155155

156156
env:
157157
GithubNugetUsername: craigfowler
@@ -181,7 +181,9 @@ jobs:
181181
name: Update docs website
182182
runs-on: ubuntu-slim
183183
needs: build_docs_site
184-
if: ${{ github.event_name != 'pull_request' && github.ref_name == 'master' }}
184+
if: ${{ github.event_name == 'workflow_run' && github.ref_name == 'master' }}
185+
outputs:
186+
committed: ${{ steps.add-and-commit.outputs.committed }}
185187

186188
steps:
187189
- name: Checkout
@@ -205,6 +207,7 @@ jobs:
205207
path: ./docs
206208
- name: Add & Commit
207209
uses: EndBug/add-and-commit@v9.1.4
210+
id: add-and-commit
208211
with:
209212
add: -A docs/
210213
default_author: github_actor
@@ -213,3 +216,28 @@ jobs:
213216
fetch: true
214217
message: Publish updated documentation website
215218
push: origin master
219+
220+
publish_github_pages:
221+
name: Publish updated Github pages site
222+
runs-on: ubuntu-slim
223+
needs: update_docs_website
224+
if: needs.update_docs_website.outputs.committed == true
225+
environment:
226+
name: github-pages
227+
url: ${{ steps.deployment.outputs.page_url }}
228+
permissions:
229+
contents: read
230+
pages: write
231+
232+
steps:
233+
- name: Checkout
234+
uses: actions/checkout@v4
235+
- name: Setup Pages
236+
uses: actions/configure-pages@v5
237+
- name: Upload artifact
238+
uses: actions/upload-pages-artifact@v3
239+
with:
240+
path: docs/
241+
- name: Deploy to GitHub Pages
242+
id: deployment
243+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)