Skip to content

Commit 946121b

Browse files
authored
Create deploy.yml
1 parent f948263 commit 946121b

File tree

1 file changed

+82
-0
lines changed

1 file changed

+82
-0
lines changed

.github/workflows/deploy.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# Sample workflow for building and deploying a Gatsby site to GitHub Pages
2+
#
3+
# To get started with Gatsby see: https://www.gatsbyjs.com/docs/quick-start/
4+
#
5+
name: Deploy Gatsby site to Pages
6+
7+
on:
8+
# Runs on pushes targeting the default branch
9+
push:
10+
branches: ["master"]
11+
12+
# Allows you to run this workflow manually from the Actions tab
13+
workflow_dispatch:
14+
15+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
16+
permissions:
17+
contents: read
18+
pages: write
19+
id-token: write
20+
21+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
22+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
23+
concurrency:
24+
group: "pages"
25+
cancel-in-progress: false
26+
27+
# Default to bash
28+
defaults:
29+
run:
30+
shell: bash
31+
32+
jobs:
33+
# Build job
34+
build:
35+
runs-on: ubuntu-latest
36+
steps:
37+
- name: Checkout
38+
uses: actions/checkout@v4
39+
- name: Setup Node
40+
uses: actions/setup-node@v4
41+
with:
42+
node-version: "20"
43+
cache: npm
44+
- name: Setup Pages
45+
id: pages
46+
uses: actions/configure-pages@v5
47+
with:
48+
# Automatically inject pathPrefix in your Gatsby configuration file.
49+
#
50+
# You may remove this line if you want to manage the configuration yourself.
51+
static_site_generator: gatsby
52+
- name: Restore cache
53+
uses: actions/cache@v4
54+
with:
55+
path: |
56+
public
57+
.cache
58+
key: ${{ runner.os }}-gatsby-build-${{ hashFiles('public') }}
59+
restore-keys: |
60+
${{ runner.os }}-gatsby-build-
61+
- name: Install dependencies
62+
run: npm ci
63+
- name: Build with Gatsby
64+
env:
65+
PREFIX_PATHS: 'true'
66+
run: npm run build
67+
- name: Upload artifact
68+
uses: actions/upload-pages-artifact@v3
69+
with:
70+
path: ./public
71+
72+
# Deployment job
73+
deploy:
74+
environment:
75+
name: github-pages
76+
url: ${{ steps.deployment.outputs.page_url }}
77+
runs-on: ubuntu-latest
78+
needs: build
79+
steps:
80+
- name: Deploy to GitHub Pages
81+
id: deployment
82+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)