You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .github/workflows/github_pages.yml
+10-4Lines changed: 10 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
# Workflow for publishing to GitHub Pages.
1
+
# Workflow for building the site and (optionally) publishing it to GitHub Pages.
2
2
name: Deploy to GitHub Pages
3
3
on:
4
4
workflow_call:
@@ -37,13 +37,15 @@ on:
37
37
default: ""
38
38
description: "The domain to be prepended to feed URLs (Pelican's FEED_DOMAIN setting). If not passed this will default to the URL of your GitHub Pages site, which is correct in most cases."
39
39
type: string
40
+
deploy:
41
+
required: false
42
+
default: true
43
+
description: "Whether to deploy the site. If true then build the site and deploy it. If false then just test that the site builds successfully but don't deploy anything."
If you want to test your build in a pull request before deploying to GitHub, your workflow might look something like this:
260
+
261
+
.. code-block:: yaml
249
262
263
+
name: Build and Deploy Site
264
+
on:
265
+
push:
266
+
branches: ["main"]
267
+
pull_request:
268
+
branches: ["main"]
269
+
workflow_dispatch:
270
+
inputs:
271
+
deploy:
272
+
required: false
273
+
default: true
274
+
description: "Whether to deploy the site. If checked, then build the site and deploy it. If not checked, then just test that the site builds successfully but don't deploy anything."
The ``on`` section of the workflow defines the events that will trigger the workflow. In this example, the workflow will run on pushes to the main branch, pull requests to the main branch, and manual runs of the workflow.
289
+
290
+
``workflow_dispatch`` defines the deploy boolean to be true by default. This means that if you run the workflow manually, it will deploy the site.
291
+
292
+
The ``deploy`` input for the job is using a set of standard GitHub workflow variables to control when ``deploy`` will either be true or false (you can customize this to your needs).
293
+
294
+
In this example, the ``deploy`` will be true if the event is a push to the main branch (or merging into main from a PR) or a manual run of the workflow. If the event is a pull request, the ``deploy`` will be false and it will only build an artifact for the site.
0 commit comments