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
π DOC: Adding github actions example to deploy.md (withastro#823)
* Adding github actions example to deploy.md
* Update wording and example
Made the suggested changes
* Apply suggestions from code review
Co-authored-by: Caleb Jasik <[email protected]>
Co-authored-by: Fred K. Schott <[email protected]>
Co-authored-by: Caleb Jasik <[email protected]>
Co-authored-by: Fred K. Schott <[email protected]>
Copy file name to clipboardexpand all lines: docs/src/pages/guides/deploy.md
+59-1
Original file line number
Diff line number
Diff line change
@@ -68,7 +68,65 @@ By default, the build output will be placed at `dist/`. You may deploy this `dis
68
68
69
69
### GitHub Actions
70
70
71
-
TODO: We'd love an example action snippet to share here!
71
+
1. Set the correct `buildOptions.site` in `astro.config.mjs`
72
+
2. Create the file `.github/workflows/main.yml` and add in the yaml below. Make sure to edit in your own details.
73
+
3. In Github go to Settings > Developer settings > Personal Access tokens. Generate a new token with repo permissions.
74
+
4. In the astro project repo (not \<YOUR USERNAME\>.github.io) go to Settings > Secrets and add your new personal access token with the name `API_TOKEN_GITHUB`.
75
+
5. When you push changes to the astro project repo CI will deploy them to \<YOUR USERNAME\>.github.io for you.
76
+
77
+
```yaml
78
+
# Workflow to build and deploy to your Github Pages repo.
79
+
80
+
# Edit your project details here.
81
+
# Remember to add API_TOKEN_GITHUB in repo Settings > Secrets as well!
82
+
env:
83
+
githubEmail: <YOUR GITHUB EMAIL ADDRESS>
84
+
deployToRepo: <NAME OF REPO TO DEPLOY TO (E.G. <YOUR USERNAME>.github.io)>
85
+
86
+
name: Github Pages Astro CI
87
+
88
+
on:
89
+
# Triggers the workflow on push and pull request events but only for the main branch
90
+
push:
91
+
branches: [ main ]
92
+
pull_request:
93
+
branches: [ main ]
94
+
95
+
# Allows you to run this workflow manually from the Actions tab.
96
+
workflow_dispatch:
97
+
98
+
jobs:
99
+
100
+
deploy:
101
+
runs-on: ubuntu-latest
102
+
103
+
steps:
104
+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
105
+
- uses: actions/checkout@v2
106
+
107
+
# Install dependencies with npm
108
+
- name: Install dependencies
109
+
run: npm ci
110
+
111
+
# Build the project and add .nojekyll file to supress default behaviour
0 commit comments