简体   繁体   English

Github Actions - 将文件复制到 VPS

[英]Github Actions - copy files to VPS

I would like to solve this at a small VPS Provider:我想在一个小型 VPS 提供商处解决这个问题:

Github worflow, when pushed files to GitHub, then "GH workflows" copies the php files to the live VPS server. Github worflow,当将文件推送到 GitHub 时,“GH 工作流”会将 php 文件复制到实时 VPS 服务器。

How can I copy them?我怎样才能复制它们?

.github/workflows/vps-deploy-prod.yml : .github/workflows/vps-deploy-prod.yml

name: vps-deploy-prod

on:
  push:
    branches:
      - master

jobs:

  build: 'VPS Run Deploy'
  runs-on: ubuntu-latest    
  steps:
    - name: 'Checkout'
      uses: action/checkout@master
    - name: 'Deploy'
      run: make vps-run-deploy

The Makefile:生成文件:

##### VPS specific target
vps-run-deploy:

?? copy files via ssh scp...?

You might consider the GitHub action appleboy/scp-action您可以考虑 GitHub 操作appleboy/scp-action

GitHub Action for copying files and artifacts via SSH.用于通过 SSH 复制文件和工件的GitHub 操作

Here is an example in this project: renatomh/gobarber-backend/.github/workflows/main.yml :这是这个项目中的一个例子: renatomh/gobarber-backend/.github/workflows/main.yml

      # Copy the repository to the directory on the server/VPS used for the application
      - name: Copy dist to VPS
        uses: appleboy/scp-action@master
        with:
          host: ${{ secrets.SSH_HOST }}
          username: ${{ secrets.SSH_USER }}
          port: ${{ secrets.SSH_PORT }}
          key: ${{ secrets.SSH_KEY }}
          # Selecting all folders except "node_modules"
          source: ".,!node_modules"
          # The path is based on the directory where the user logged into the server starts
          target: "~/app/gobarber-backend"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM