Skip to content

Commit 8ce6d14

Browse files
authored
Update static.yml
1 parent b642ffb commit 8ce6d14

File tree

1 file changed

+47
-13
lines changed

1 file changed

+47
-13
lines changed

.github/workflows/static.yml

Lines changed: 47 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
# Simple workflow for deploying static content to GitHub Pages
2-
name: Deploy static content to Pages
1+
name: Deploy to Pages
32

43
on:
54
# Runs on pushes targeting the default branch
@@ -21,23 +20,58 @@ concurrency:
2120
group: "pages"
2221
cancel-in-progress: false
2322

23+
# Default to bash
24+
defaults:
25+
run:
26+
shell: bash
27+
2428
jobs:
25-
# Single deploy job since we're just deploying
26-
deploy:
27-
environment:
28-
name: github-pages
29-
url: ${{ steps.deployment.outputs.page_url }}
29+
# Build job
30+
build:
3031
runs-on: ubuntu-latest
3132
steps:
3233
- name: Checkout
33-
uses: actions/checkout@v4
34+
uses: actions/checkout@v3
35+
- name: Detect package manager
36+
id: detect-package-manager
37+
run: |
38+
if [ -f "${{ github.workspace }}/yarn.lock" ]; then
39+
echo "manager=yarn" >> $GITHUB_OUTPUT
40+
echo "command=install" >> $GITHUB_OUTPUT
41+
exit 0
42+
elif [ -f "${{ github.workspace }}/package.json" ]; then
43+
echo "manager=npm" >> $GITHUB_OUTPUT
44+
echo "command=ci" >> $GITHUB_OUTPUT
45+
exit 0
46+
else
47+
echo "Unable to determine package manager"
48+
exit 1
49+
fi
50+
- name: Setup Node
51+
uses: actions/setup-node@v3
52+
with:
53+
node-version: "18"
54+
cache: ${{ steps.detect-package-manager.outputs.manager }}
3455
- name: Setup Pages
35-
uses: actions/configure-pages@v5
56+
id: pages
57+
uses: actions/configure-pages@v3
58+
- name: Install dependencies
59+
run: ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }}
60+
- name: Build
61+
run: ${{ steps.detect-package-manager.outputs.manager }} run build
3662
- name: Upload artifact
37-
uses: actions/upload-pages-artifact@v3
63+
uses: actions/upload-pages-artifact@v1
3864
with:
39-
# Upload entire repository
40-
path: '.'
65+
path: ./docs
66+
67+
# Deployment job
68+
deploy:
69+
environment:
70+
name: github-pages
71+
url: ${{ steps.deployment.outputs.page_url }}
72+
runs-on: ubuntu-latest
73+
needs: build
74+
steps:
4175
- name: Deploy to GitHub Pages
4276
id: deployment
43-
uses: actions/deploy-pages@v4
77+
uses: actions/deploy-pages@v2

0 commit comments

Comments
 (0)