Skip to content

Commit e012711

Browse files
committed
2 parents 3409fba + 0335daf commit e012711

1 file changed

Lines changed: 32 additions & 32 deletions

File tree

.github/workflows/main.yml

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,42 +2,42 @@ name: CI/CD
22

33
on:
44
push:
5-
branches: [ master ]
5+
branches: [master]
66
pull_request:
7-
branches: [ master ]
7+
branches: [master]
8+
9+
permissions:
10+
contents: write
811

912
jobs:
1013
build:
11-
1214
runs-on: ubuntu-latest
1315

14-
strategy:
15-
matrix:
16-
node-version: [12.x]
17-
1816
steps:
19-
- name: Checkout repository
20-
uses: actions/checkout@v2
21-
22-
- name: Set up Node.js ${{ matrix.node-version }}
23-
uses: actions/setup-node@v1
24-
with:
25-
node-version: ${{ matrix.node-version }}
26-
27-
- name: Install dependencies
28-
run: npm install
29-
30-
- name: Build
31-
run: npm run build
32-
33-
- name: Deploy
34-
run: |
35-
git config --global user.name $user_name
36-
git config --global user.email $user_email
37-
git remote set-url origin https://${github_token}@github.com/${repository}
38-
npm run deploy
39-
env:
40-
user_name: 'github-actions[bot]'
41-
user_email: 'github-actions[bot]@users.noreply.github.com'
42-
github_token: ${{ secrets.ACTIONS_DEPLOY_ACCESS_TOKEN }}
43-
repository: ${{ github.repository }}
17+
- name: Checkout repository
18+
uses: actions/checkout@v4
19+
20+
- name: Set up Node.js
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: 20
24+
cache: npm
25+
26+
- name: Install dependencies
27+
run: npm ci
28+
29+
- name: Build
30+
run: npm run build
31+
32+
- name: Deploy
33+
if: github.event_name == 'push'
34+
run: |
35+
git config --global user.name "$user_name"
36+
git config --global user.email "$user_email"
37+
git remote set-url origin https://${github_token}@github.com/${repository}
38+
npm run deploy
39+
env:
40+
user_name: github-actions[bot]
41+
user_email: github-actions[bot]@users.noreply.github.com
42+
github_token: ${{ secrets.ACTIONS_DEPLOY_ACCESS_TOKEN }}
43+
repository: ${{ github.repository }}

0 commit comments

Comments
 (0)