Skip to content

Commit 5be2226

Browse files
committed
build: add deploy github actions
1 parent c5a8e4f commit 5be2226

2 files changed

Lines changed: 86 additions & 0 deletions

File tree

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Deploy preview
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
8+
deploy-preview:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- uses: actions/checkout@v4
13+
14+
- uses: actions/setup-node@v4
15+
with:
16+
node-version: lts/*
17+
18+
- name: Install dependencies
19+
run: npm ci
20+
21+
- name: Build
22+
run: npm run build
23+
24+
- name: Get last commit message
25+
id: get_commit_message
26+
run: echo "COMMIT_MESSAGE=$(git log -1 --pretty=%B)" >> $GITHUB_ENV
27+
28+
# https://github.com/marketplace/actions/netlify-actions
29+
- name: Deploy to Netlify
30+
uses: nwtgck/actions-netlify@v3.0
31+
with:
32+
publish-dir: './dist'
33+
github-token: ${{ secrets.GITHUB_TOKEN }}
34+
production-branch: main
35+
deploy-message: ${{ env.COMMIT_MESSAGE }}
36+
enable-pull-request-comment: false
37+
netlify-config-path: ./netlify.toml
38+
alias: preview-${{ github.event.number }}
39+
github-deployment-environment: preview
40+
env:
41+
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
42+
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
43+
timeout-minutes: 1

.github/workflows/deploy.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Deploy
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
workflow_dispatch:
7+
8+
jobs:
9+
10+
deploy:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- uses: actions/setup-node@v4
17+
with:
18+
node-version: lts/*
19+
20+
- name: Install dependencies
21+
run: npm ci
22+
23+
- name: Build
24+
run: npm run build
25+
26+
- name: Get last commit message
27+
id: get_commit_message
28+
run: echo "COMMIT_MESSAGE=$(git log -1 --pretty=%B)" >> $GITHUB_ENV
29+
30+
- name: Deploy to Netlify
31+
uses: nwtgck/actions-netlify@v3.0
32+
with:
33+
publish-dir: './dist'
34+
github-token: ${{ secrets.GITHUB_TOKEN }}
35+
production-branch: main
36+
production-deploy: true
37+
deploy-message: ${{ env.COMMIT_MESSAGE }}
38+
netlify-config-path: ./netlify.toml
39+
env:
40+
# https://app.netlify.com/user/applications
41+
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
42+
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
43+
timeout-minutes: 1

0 commit comments

Comments
 (0)