我想创建一个作业操作来构建一个Go应用程序,并在digitalocean上部署一个水滴。我正试着用它,但是
name: Countinus Deployments
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
build:
runs-on: ubuntu-latest
- name: Checkout the repository
uses: actions/checkout@v2
- name: Set up Go 1.13
uses: actions/setup-go@v1
with:
go-version: 1.13
id: go
- name: Deploy and rebuild on server
uses: appleboy/ssh-action@master
with:
host: xxxxxxxxxxx
username: root
key: ${{ secrets.serverKey }}
port: 22
script:
cd go/victorydash/ &&
git pull origin master &&
git status &&
echo $PATH &&
go build -o app main.go &&
systemctl restart goweb.service &&
systemctl status goweb 但是代码"go build -o app main.go &&“没有在服务器上构建有人知道什么解决方案吗?
发布于 2020-12-08 09:44:03
不太清楚你想要什么,以及你在YAML文件中写的是什么。我想你需要在数字海洋上部署应用程序。
如果你想直接在你的主机上构建和部署-你需要手动克隆repo并安装golang。因此,使用操作没有任何意义(仅用于触发)
发布于 2020-12-09 05:07:10
我已经找到了一个解决方案
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
- name: Checkout the repository
uses: actions/checkout@v2
- name: Set up Go 1.13
uses: actions/setup-go@v1
with:
go-version: 1.13
- name: Build app
run: go build -o app main.go
- name: SCP to Ocean
uses: appleboy/scp-action@master
with:
host: ${{ secrets.host }}
username: ${{ secrets.user }}
key: ${{ secrets.serverKey }}
port:
source: "app"
target: "dist"
- name: Deploy and rebuild on server
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.host }}
username: ${{ secrets.user }}
key: ${{ secrets.serverKey }}
port: ${{ secrets.port }}
script:
systemctl restart goweb.service &&
systemctl status goweb https://stackoverflow.com/questions/65190755
复制相似问题