Skip to content

Commit 3c2d4ab

Browse files
authored
Create node.js.yml
1 parent 451d11f commit 3c2d4ab

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

.github/workflows/node.js.yml

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
3+
4+
name: Node.js CI
5+
6+
on:
7+
push:
8+
branches: [ "master" ]
9+
10+
jobs:
11+
build:
12+
13+
runs-on: ubuntu-latest
14+
15+
strategy:
16+
matrix:
17+
node-version: [18.x]
18+
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
19+
20+
steps:
21+
- uses: actions/checkout@v4
22+
- name: Use Node.js ${{ matrix.node-version }}
23+
uses: actions/setup-node@v4
24+
with:
25+
node-version: ${{ matrix.node-version }}
26+
cache: 'npm'
27+
- run: npm ci
28+
- run: npm run build --if-present
29+
- run: npm test
30+
deploy:
31+
runs-on: ubuntu-latest
32+
steps:
33+
- uses: actions/download-artifact@v2
34+
with:
35+
name: build
36+
path: build
37+
- name: Create SSH key
38+
run: |
39+
install -m 600 -D /dev/null ~/.ssh/id_ed25519
40+
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_ed25519
41+
echo "${{ secrets.SSH_KNOWN_HOSTS }}" > ~/.ssh/known_hosts
42+
- name: Deploy with rsync
43+
run: rsync -rav --delete build/ musicbox@${{ secrets.MUSICBOX_SERVER_IP }}:/home/musicbox/api/production/

0 commit comments

Comments
 (0)