Skip to content

Commit 38e42fe

Browse files
authored
Merge pull request #42 from actions/more-doc
Update README to document a few things
2 parents 4d0af46 + 44ea2ec commit 38e42fe

File tree

1 file changed

+63
-7
lines changed

1 file changed

+63
-7
lines changed

README.md

Lines changed: 63 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,73 @@
11
# Deploy-Pages
22

3-
This deploys artifacts to GitHub Pages.
3+
This action is used to deploy [Actions artifacts][artifacts] to GitHub Pages.
44

5-
# Scope
5+
## Scope
66

7-
⚠️ Official support for building Pages with Actions is in public beta at the moment. The scope is currently limited to **public repositories only**.
7+
⚠️ Official support for building Pages with Actions is in public beta at the moment.
88

9-
# Usage
9+
## Usage
1010

11-
See [action.yml](action.yml)
11+
See [action.yml](action.yml) for the various `inputs` this action supports.
1212

13-
<!-- TODO: document custom workflow -->
13+
For examples that make use of this action, check out our [starter-workflows][starter-workflows] in a variety of frameworks.
1414

15-
# License
15+
This action expects an artifact named `github-pages` to have been created prior to execution. This is done automatically using [`actions/upload-pages-artifact`][upload-pages-artifact].
16+
17+
We recommend this action to be used in a dedicated job:
18+
19+
```yaml
20+
jobs:
21+
# Build job
22+
build:
23+
# <Not provided for brevity>
24+
# At a minimum this job should upload artifacts using actions/upload-pages-artifact
25+
26+
# Deploy job
27+
deploy:
28+
# Add a dependency to the build job
29+
needs: build
30+
31+
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
32+
permissions:
33+
pages: write # to deploy to Pages
34+
id-token: write # to verify the deployment originates from an appropriate source
35+
36+
# Deploy to the github-pages environment
37+
environment:
38+
name: github-pages
39+
url: ${{ steps.deployment.outputs.page_url }}
40+
41+
# Specify runner + deployment step
42+
runs-on: ubuntu-latest
43+
steps:
44+
- name: Deploy to GitHub Pages
45+
id: deployment
46+
uses: actions/deploy-pages@v1
47+
```
48+
49+
## Security considerations
50+
51+
There are a few important considerations to be aware of:
52+
53+
1. The artifact being deployed must have been uploaded in a previous step, either in the same job or a separate job that doesn't execute until the upload is complete.
54+
55+
2. The job that executes the deployment must at minimum have the following permissions:
56+
- `pages: write`
57+
- `id-token: write`
58+
59+
3. The deployment should target the `github-pages` environment (you may use a different environment name if needed, but this is not recommended.)
60+
61+
4. If your Pages site is using a source branch, the deployment must originate from this source branch unless [your environment is protected][environment-protection] in which case the environment protection rules take precedence over the source branch rule
62+
63+
5. If your Pages site is using GitHub Actions as the source, while not required we highly recommend you also [protect your environment][environment-protection] (we do it by default for you)
64+
65+
## License
1666

1767
The scripts and documentation in this project are released under the [MIT License](LICENSE).
68+
69+
<!-- references -->
70+
[starter-workflows]: https://github.com/actions/starter-workflows/tree/main/pages
71+
[upload-pages-artifact]: https://github.com/actions/upload-pages-artifact
72+
[artifacts]: https://docs.github.com/en/actions/using-workflows/storing-workflow-data-as-artifacts
73+
[environment-protection]: https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#environment-protection-rules

0 commit comments

Comments
 (0)