Skip to content

Commit f5e6381

Browse files
committed
update deploy scripts for GitHub Actions
1 parent 44d58d9 commit f5e6381

File tree

3 files changed

+28
-2
lines changed

3 files changed

+28
-2
lines changed

.github/workflows/deploy.yml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Gatsby Deploy
2+
3+
on:
4+
push:
5+
branches: main
6+
7+
env:
8+
GH_TOKEN: ${{ secrets.GH_TOKEN }}
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: GitHub Config
15+
run: |
16+
git config --global user.email "[email protected]"
17+
git config --global user.name "jiros"
18+
- name: Checkout
19+
uses: actions/checkout@v2
20+
- name: Install dependencies
21+
run: |
22+
npm install
23+
- name: Deploy
24+
run: npm run deploy:ci

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,4 +100,4 @@ The fastest way to combine your favorite tools and APIs to build the fastest sit
100100
101101
# Deploy to GitHub Pages
102102
103-
https://dev.to/flexdinesh/deploy-gatsby-sites-to-github-pages-eed
103+
https://medium.com/@sam-king/deploying-a-gatsby-site-to-github-pages-using-github-actions-ci-cd-be0465a8cdb8

package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@
2929
"start": "gatsby develop",
3030
"serve": "gatsby serve",
3131
"clean": "gatsby clean",
32-
"test": "echo \"Write tests! -> https://gatsby.dev/unit-testing\" && exit 1"
32+
"test": "echo \"Write tests! -> https://gatsby.dev/unit-testing\" && exit 1",
33+
"deploy": "gatsby build --prefix-paths && gh-pages -d public",
34+
"deploy:ci": "gatsby build --prefix-paths && gh-pages -d public -r https://[email protected]/username/repo.git"
3335
},
3436
"repository": {
3537
"type": "git",

0 commit comments

Comments
 (0)