在GitHub上自动发布.Net核心应用程序

在GitHub上自动发布.Net核心应用程序,github,.net-core,devops,github-actions,Github,.net Core,Devops,Github Actions,我不想在GitHub Repos中制作.Net Core应用程序,该应用程序自动生成并将生成的二进制文件压缩到新版本,但我不知道如何在GitHub上设置它。 例如,我有我的.Net核心控制台应用程序,并将我的分支更改为master。现在,构建应该在构建之后开始(这就是我所拥有的),二进制文件应该压缩并附加到新版本,这样就会有连续的新版本 希望有人能理解并提供帮助 这是我到目前为止的工作流程 name: .NET Core on: push: branches: [ master ]

我不想在GitHub Repos中制作.Net Core应用程序,该应用程序自动生成并将生成的二进制文件压缩到新版本,但我不知道如何在GitHub上设置它。 例如,我有我的.Net核心控制台应用程序,并将我的分支更改为master。现在,构建应该在构建之后开始(这就是我所拥有的),二进制文件应该压缩并附加到新版本,这样就会有连续的新版本

希望有人能理解并提供帮助

这是我到目前为止的工作流程

name: .NET Core

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.201
    - name: Install dependencies
      run: dotnet restore
    - name: Build
      run: dotnet build --configuration Release --no-restore

多亏了迪帕克·米什拉,我现在解决了这个问题

name: .NET Core

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
      run: dotnet build --configuration Release --no-restore
    - name: Zip the Build
      run: zip -r ${{ secrets.ReleaseZipName }} ./AppName/bin/Release/netcoreapp3.1/ 
    - name: Create Release
      id: create_release
      uses: actions/create-release@v1
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      with:
        tag_name: ${{ github.run_number }}
        release_name: Release ${{ github.ref }}
        body: New Release.
        draft: false
        prerelease: false
    - name: Upload Release Asset
      uses: actions/upload-release-asset@v1
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      with:
        upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps 
        asset_path: ./${{ secrets.ReleaseZipName }}.zip
        asset_name: ${{ secrets.ReleaseZipName }}.zip
        asset_content_type: application/zip

您需要使用一些工具,如VSTS(azure devops)或Jenkins@DeepakMishra抱歉,我认为你没有理解我,或者我低估了我的目标我不想将应用部署到任何服务,Git Hub有一个发布功能,您可以在此页面手动上载一些二进制文件等。您也可以从该页面下载发布版本,但我不想手动上载我的二进制文件。您可以从项目属性或.csproj文件附加生成后事件。然后,您可以从该事件运行github api。如果我理解正确,您正在尝试将bin/release上载到github上的某个位置。您可以从项目属性或.csproj文件中附加生成后事件。然后可以从该事件运行github api。或者,您可以使用在代码中使用msbuild/vsbuild任务的工具,然后发布到github版本。github发行版必须有一个上传api。@DeepakMishra很酷,我会试试的,谢谢