linux - 无法使用 GitHub Actions/Gitlab CI/CD 通过 SCP 部署(超时)
问题描述
我有一个 React.js 应用程序,我正在尝试使用 Github Actions 进行自动部署。我遵循了 Github 在其操作页面上的一些示例。构建看起来正确,我将构建文件夹作为工件输出,但我试图通过 SCP 将构建文件夹发送到我的远程服务器,但看起来我的跑步者没有互联网连接,因为我收到超时。
我在我的机器上尝试了相同的 scp 命令,它运行良好。
到目前为止,我的 yaml 是这样的:
# This is a basic workflow to help you get started with Actions
name: CI
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: [ubuntu-latest]
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
# Runs a set of commands using the runners shell
#sudo apt-get update && sudo apt-get install -y lftp && sudo rm -rf /var/lib/apt/lists/*
- name: Run a multi-line script
run: |
npm install
CI=false npm run-script build
- name: List output files
run: ls
- name: Create security file
run: |
touch securityfile
echo -e "${{ secrets.PRIVATE_KEY }}" >securityfile
chmod 600 securityfile
- name: Deploy via SCP
run: scp -o StrictHostKeyChecking=no -v -i securityfile -r build/ ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:/www
我也尝试在 GitLab 中做一个管道,但得到了相同的结果(超时)。
解决方案
推荐阅读
- javascript - 嵌套 Firestore 查询未将结果返回到主查询
- html - 如何摆脱引导 css 导航栏中的边距
- android - 我正在尝试保存从 Android 相机拍摄的照片,但收到 OutOfMemoryError 错误
- qlikview - How get the distinct value of calls of distinct ID list?
- c++ - 如何从“fftw_dft_r2c”生成的结果中确定原始矩阵大小?
- python - Python 3.5:输入函数不需要回车,只接受一个字符,只有满足给定条件才返回字符
- android - 使用 Dialogflow 和 Firebase Firestore 导致 protobuf 冲突(protobuf-lite 与 protobuf-java)
- c# - Socket.EndReceive workflow
- css - How to create a global style in React
- matlab - Total number of pages in a PDF document