47 lines
1.1 KiB
YAML
47 lines
1.1 KiB
YAML
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
build:
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Node 20
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '20'
|
|
registry-url: 'https://registry.npmjs.org'
|
|
|
|
- name: Install Node.js dependencies
|
|
run: npm install
|
|
|
|
- name: Build
|
|
run: npm run build
|
|
|
|
- name: Upload build artifact
|
|
uses: 'christopherhx/gitea-upload-artifact@v4'
|
|
with:
|
|
name: build-dist
|
|
retention-days: 1
|
|
path: ./dist
|
|
|
|
deploy:
|
|
needs: build
|
|
steps:
|
|
- name: Download build artifact
|
|
uses: 'christopherhx/gitea-download-artifact@v4'
|
|
with:
|
|
name: build-dist
|
|
path: dist
|
|
|
|
- name: Deploy to Server
|
|
uses: wlixcc/SFTP-Deploy-Action@v1.2.6
|
|
with:
|
|
username: ${{ secrets.FTP_USERNAME }}
|
|
server: ${{ secrets.FTP_HOST }}
|
|
ssh_private_key: ${{ secrets.DEPLOY_PRIVATE_KEY }}
|
|
local_path: 'dist/*'
|
|
remote_path: ${{ secrets.FTP_PATH }}
|