Skip to content

Commit 54ded7a

Browse files
authored
Update deploy.yml
1 parent 59d93eb commit 54ded7a

File tree

1 file changed

+37
-36
lines changed

1 file changed

+37
-36
lines changed

.github/workflows/deploy.yml

Lines changed: 37 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,49 @@
1-
# Simple workflow for deploying static content to GitHub Pages
2-
name: Deploy static content to Pages
1+
name: Deploy
32

43
on:
5-
# Runs on pushes targeting the default branch
64
push:
7-
branches: ['main']
8-
9-
# Allows you to run this workflow manually from the Actions tab
10-
workflow_dispatch:
11-
12-
# Sets the GITHUB_TOKEN permissions to allow deployment to GitHub Pages
13-
permissions:
14-
contents: read
15-
pages: write
16-
id-token: write
17-
18-
# Allow one concurrent deployment
19-
concurrency:
20-
group: 'pages'
21-
cancel-in-progress: true
5+
branches:
6+
- main
227

238
jobs:
24-
# Single deploy job since we're just deploying
25-
deploy:
26-
environment:
27-
name: github-pages
28-
url: ${{ steps.deployment.outputs.page_url }}
9+
build:
10+
name: Build
2911
runs-on: ubuntu-latest
12+
3013
steps:
31-
- name: Checkout
32-
uses: actions/checkout@v4
33-
- name: Set up Node
34-
uses: actions/setup-node@v4
14+
- name: Checkout repo
15+
uses: actions/checkout@v3
16+
17+
- name: Setup Node
18+
uses: actions/setup-node@v3
19+
3520
- name: Install dependencies
3621
uses: bahmutov/npm-install@v1
37-
- name: Build
22+
23+
- name: Build project
3824
run: npm run build
39-
- name: Setup Pages
40-
uses: actions/configure-pages@v4
41-
- name: Upload artifact
42-
uses: actions/upload-pages-artifact@v3
25+
26+
- name: Upload production-ready build files
27+
uses: actions/upload-artifact@v3
4328
with:
44-
# Upload dist folder
45-
path: './dist'
29+
name: production-files
30+
path: ./dist
31+
32+
deploy:
33+
name: Deploy
34+
needs: build
35+
runs-on: ubuntu-latest
36+
if: github.ref == 'refs/heads/main'
37+
38+
steps:
39+
- name: Download artifact
40+
uses: actions/download-artifact@v3
41+
with:
42+
name: production-files
43+
path: ./dist
44+
4645
- name: Deploy to GitHub Pages
47-
id: deployment
48-
uses: actions/deploy-pages@v4
46+
uses: peaceiris/actions-gh-pages@v3
47+
with:
48+
github_token: ${{ secrets.GITHUB_TOKEN }}
49+
publish_dir: ./dist

0 commit comments

Comments
 (0)