Skip to content

Commit

Permalink
replace github action with docs version
Browse files Browse the repository at this point in the history
  • Loading branch information
MattReimer committed Dec 20, 2023
1 parent 004466a commit 4ea4f41
Showing 1 changed file with 14 additions and 25 deletions.
39 changes: 14 additions & 25 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Gatsby Publish

name: Gatsby GHPages Publish
# NOTE: This is designed to work for a site living in the /docs folder. You'll need to make changes if it is not.
on:
push:
branches:
Expand Down Expand Up @@ -28,26 +28,13 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Detect package manager
id: detect-package-manager
run: |
if [ -f "${{ github.workspace }}/yarn.lock" ]; then
echo "manager=yarn" >> $GITHUB_OUTPUT
echo "command=install" >> $GITHUB_OUTPUT
exit 0
elif [ -f "${{ github.workspace }}/package.json" ]; then
echo "manager=npm" >> $GITHUB_OUTPUT
echo "command=ci" >> $GITHUB_OUTPUT
exit 0
else
echo "Unable to determine package manager"
exit 1
fi

- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: "18"
cache: ${{ steps.detect-package-manager.outputs.manager }}
node-version-file: ./docs/.nvmrc
cache-dependency-path: ./docs/package.json
cache: yarn

- name: Setup Pages
id: pages
Expand All @@ -62,24 +49,26 @@ jobs:
uses: actions/cache@v3
with:
path: |
public
.cache
./docs/public
./docs/.cache
key: ${{ runner.os }}-gatsby-build-${{ hashFiles('public') }}
restore-keys: |
${{ runner.os }}-gatsby-build-
- name: Install dependencies
run: ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }}
working-directory: ./docs
run: yarn install

- name: Build with Gatsby
working-directory: ./docs
env:
PREFIX_PATHS: 'true'
run: ${{ steps.detect-package-manager.outputs.manager }} run build
run: yarn run build

- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: ./public
path: ./docs/public

# Deployment job
deploy:
Expand Down

0 comments on commit 4ea4f41

Please sign in to comment.