55 lines
1.1 KiB
YAML
55 lines
1.1 KiB
YAML
name: Node.js CI/CD
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: windows-latest
|
|
|
|
steps:
|
|
- name: Checkout source code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Check Git
|
|
shell: powershell
|
|
run: |
|
|
git --version
|
|
|
|
- name: Check Node.js
|
|
shell: powershell
|
|
run: |
|
|
node --version
|
|
|
|
- name: Check npm
|
|
shell: powershell
|
|
run: |
|
|
npm --version
|
|
|
|
- name: Install dependencies
|
|
shell: powershell
|
|
run: |
|
|
npm ci
|
|
|
|
- name: Check application
|
|
shell: powershell
|
|
run: |
|
|
node --check app.js
|
|
|
|
- name: Deploy application
|
|
shell: powershell
|
|
run: |
|
|
$deployPath = "D:\apps\my_temp\my-node-app"
|
|
|
|
if (!(Test-Path $deployPath)) {
|
|
New-Item -ItemType Directory -Path $deployPath -Force
|
|
}
|
|
|
|
Write-Host "Deploying to $deployPath"
|
|
|
|
Copy-Item -Path ".\*" -Destination $deployPath -Recurse -Force
|
|
|
|
Write-Host "Deployment completed successfully."
|