sftp-test #12
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs | |
# ftp,centos或Linux版 | |
#name: CI | |
# | |
#on: | |
# push: | |
# branches: | |
# - main | |
# | |
#jobs: | |
# build: | |
# runs-on: self-hosted | |
# | |
# steps: | |
# - name: Checkout code | |
# uses: actions/checkout@v2 | |
# | |
# - name: Run a script | |
# run: echo "Running on CentOS 8.2" | |
# ftp,ubuntu版本 | |
#name: Node.js CI | |
##on: [push] | |
#on: | |
# push: | |
# branches: [ "master",] | |
## pull_request: | |
## branches: [ "master" ] | |
#jobs: | |
# build: | |
# runs-on: centos-8.2 | |
# strategy: | |
# matrix: | |
# node-version: [20.x] | |
# # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ | |
# steps: | |
# - uses: actions/checkout@v4 | |
# - name: Use Node.js ${{ matrix.node-version }} | |
# uses: actions/setup-node@v3 | |
# with: | |
# node-version: ${{ matrix.node-version }} | |
# cache: 'npm' | |
# - run: npm install | |
# - run: npm run build --if-present | |
# - name: FTP Deploy | |
# uses: SamKirkland/FTP-Deploy-Action@3.0.0 | |
# with: | |
# ftp-server: sftp://sftp.yangmufa.com | |
# ftp-username: ${{secrets.sftp_user }} | |
# ftp-password: ${{ secrets.sftp_pwd }} | |
# local-dir: build/ | |
# env: | |
# CI: true | |
# sftp版本,ubuntu系统 | |
#name: Node.js CI | |
# | |
#on: | |
# push: | |
# branches: [ "master" ] | |
## pull_request: | |
## branches: [ "master" ] | |
#jobs: | |
# build: | |
# # ubuntu系统 | |
# runs-on: ubuntu-latest | |
# strategy: | |
# matrix: | |
# node-version: [20.x] | |
# # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ | |
# steps: | |
# - uses: actions/checkout@v4 | |
# - name: Use Node.js ${{ matrix.node-version }} | |
# uses: actions/setup-node@v3 | |
# with: | |
# node-version: ${{ matrix.node-version }} | |
# cache: 'npm' | |
# - run: npm install | |
# - run: npm run build --if-present | |
# - name: Clean remote directory | |
# uses: appleboy/ssh-action@v0.1.5 | |
# with: | |
# host: sftp.yangmufa.com | |
## username: ${{ secrets.sftp_user }} | |
## key: ${{ secrets.sftp_pwd }} | |
# username: "sftpuser" | |
# key: "sftppassword" | |
# # -mindepth 1 确保不会删除 upload 目录本身,只删除其中的内容 | |
# # ! -name 'filename' 用于排除特定文件和文件夹 | |
# # -exec rm -rf {} + 将找到的文件和文件夹传递给 rm -rf 命令以进行删除 | |
# script: | | |
# find /docker/nginx/html/itBlog/upload -mindepth 1 \ | |
# ! -name 'resume' \ | |
# ! -name 'homepage' \ | |
# -exec rm -rf {} + | |
# - name: SFTP Deploy | |
# uses: appleboy/scp-action@v0.1.5 | |
# with: | |
# source: "build/*" | |
# target: "/docker/nginx/html/itBlog/upload" | |
# host: sftp.yangmufa.com | |
## username: ${{ secrets.sftp_user }} | |
## key: ${{ secrets.sftp_pwd }} | |
# username: "sftpuser" | |
# key: "sftppassword" | |
# env: | |
# CI: true | |
name: Node.js CI | |
on: | |
push: | |
branches: [ "master" ] | |
## pull_request: | |
# branches: [ "master" ] | |
jobs: | |
build: | |
# ubuntu系统 | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [20.x] | |
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/ | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'npm' | |
- run: npm install | |
- run: npm run build --if-present | |
- name: Clean remote directory | |
uses: appleboy/ssh-action@v0.1.5 | |
with: | |
host: sftp.yangmufa.com | |
username: "sftpuser" | |
key: ${{ secrets.SFTP_PRIVATE_KEY }} | |
# -mindepth 1 确保不会删除 upload 目录本身,只删除其中的内容 | |
# ! -name 'filename' 用于排除特定文件和文件夹 | |
# -exec rm -rf {} + 将找到的文件和文件夹传递给 rm -rf 命令以进行删除 | |
script: | | |
find /docker/nginx/html/itBlog/upload -mindepth 1 \ | |
! -name 'resume' \ | |
! -name 'homepage' \ | |
-exec rm -rf {} + | |
- name: SFTP Deploy | |
uses: appleboy/scp-action@v0.1.5 | |
with: | |
source: "build/*" | |
target: "/docker/nginx/html/itBlog/upload" | |
host: sftp.yangmufa.com | |
username: "sftpuser" | |
key: ${{ secrets.SFTP_PRIVATE_KEY }} | |
env: | |
CI: true | |