[英]dotnet publish and deploy with ftp Github Actions
I am trying to set up Github Actions to: -build .net Core app -test the app (unit tests) -make a release (dotnet publish) -deploy to ftp server我正在尝试设置 Github 操作以: - 构建 .net 核心应用 - 测试应用(单元测试) - 发布(dotnet 发布) - 部署到 ZFF104B2DFAB9FE8C0676587292A636D3
I am having some issues with the last step.我在最后一步遇到了一些问题。 I am using this action to deploy to ftp: https://github.com/SamKirkland/FTP-Deploy-Action我正在使用此操作部署到 ftp: https://github.com/SamKirkland/FTP-Deploy-Action
It always deploys the whole repository instead of just the release files.它总是部署整个存储库,而不仅仅是发布文件。
My workflow:我的工作流程:
name: BuildAndTest
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.101
- name: Install dependencies
run: dotnet restore
- name: Build with dotnet
run: dotnet build --configuration Release --no-restore
- name: Test
run: dotnet test --no-restore --verbosity normal
- name: Publish
run: dotnet publish MyApp.sln --configuration Release --framework netcoreapp3.1 --output ./publish --runtime win-x86 --self-contained true -p:PublishTrimmed=true -p:PublishSingleFile=true
- name: FTP Deploy
uses: SamKirkland/FTP-Deploy-Action@3.0.0
with:
# Deployment destination server & path. Formatted as protocol://domain.com:port/full/destination/path/
ftp-server: ${{ secrets.FTP_SERVER }}
# FTP account username
ftp-username: ${{ secrets.FTP_USERNAME }}
# FTP account password
ftp-password: ${{ secrets.FTP_PASSWORD }}
# The local folder to copy, defaults to root project folder
local-dir: /home/runner/work/MyApp/MyApp/publish/
local-dir is pointing at the directory i specified in the dotnet publish command local-dir 指向我在 dotnet publish 命令中指定的目录
The workflow does not fail but is not transferring the correct files.工作流没有失败,但没有传输正确的文件。 What am I missing?我错过了什么?
Thanks in advance!提前致谢!
Make it Simple!!让它变得简单!!
Change the publish command更改发布命令
-name: Publish
run: dotnet publish -c Release --output ./Release
Then just send the files from Release folder local-dir: ./Release/
然后只需从 Release 文件夹local-dir: ./Release/
发送文件
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.