Skip to content

Commit 038470c

Browse files
committed
Gatsby starter workflow
Signed-off-by: Gopal S Akshintala <gopala.akshintala@salesforce.com>
1 parent 437e956 commit 038470c

File tree

1 file changed

+48
-10
lines changed

1 file changed

+48
-10
lines changed

.github/workflows/gatsby.yml

Lines changed: 48 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,82 @@
1-
name: Gatsby Publish to Github Pages
1+
# Sample workflow for building and deploying a Gatsby site to GitHub Pages
2+
# https://github.com/actions/starter-workflows/blob/main/pages/gatsby.yml
3+
#
4+
name: Publish Gatsby site to Pages
5+
26
on:
7+
# Runs on pushes targeting the default branch
38
push:
4-
branches: ["source-v2"]
9+
branches: ["$DEFAULT_BRANCH"]
10+
11+
# Allows you to run this workflow manually from the Actions tab
512
workflow_dispatch:
13+
14+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
615
permissions:
716
contents: read
817
pages: write
918
id-token: write
19+
20+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
21+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
1022
concurrency:
1123
group: "pages"
1224
cancel-in-progress: false
25+
26+
# Default to bash
1327
defaults:
1428
run:
1529
shell: bash
30+
1631
jobs:
32+
# Build job
1733
build:
1834
runs-on: ubuntu-latest
1935
steps:
2036
- name: Checkout
21-
uses: actions/checkout@v4.1.1
37+
uses: actions/checkout@v4
2238
- name: volta-cli
2339
uses: volta-cli/action@v4.0.1
2440
- name: Setup Node
25-
uses: actions/setup-node@v4.0.1
41+
uses: actions/setup-node@v4
2642
with:
2743
cache: yarn
28-
- name: Configure GitHub Pages
44+
- name: Setup Pages
2945
id: pages
30-
uses: actions/configure-pages@v4.0.0
46+
uses: actions/configure-pages@v4
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
3152
- name: Restore cache
32-
uses: actions/cache@v4.0.0
53+
uses: actions/cache@v4
3354
with:
3455
path: |
3556
public
3657
.cache
3758
key: ${{ runner.os }}-gatsby-build-${{ hashFiles('public') }}
3859
restore-keys: |
3960
${{ runner.os }}-gatsby-build-
40-
- name: Gatsby Publish
41-
uses: enriikke/gatsby-gh-pages-action@v2.2.1
61+
- name: Install dependencies
62+
run: yarn install
63+
- name: Build with Gatsby
64+
env:
65+
PREFIX_PATHS: 'true'
66+
run: yarn build
67+
- name: Upload artifact
68+
uses: actions/upload-pages-artifact@v3
4269
with:
43-
access-token: ${{ secrets.ACCESS_TOKEN }}
70+
path: ./public
4471

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)