首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在GitHub上自动化发布.Net核心应用

在GitHub上自动化发布.Net核心应用
EN

Stack Overflow用户
提问于 2020-04-25 18:39:12
回答 1查看 97关注 0票数 0

我不想让.Net核心应用在GitHub Repos中自动构建,并将构建的二进制压缩到新版本,但我不想在GitHub up上设置它。例如,我有我的.Net核心控制台应用程序,并将我的分支拖入到主程序中。现在构建应该开始了(这就是我所拥有的),在构建之后,二进制文件应该被压缩并附加到新的版本中,所以将会有持续不断的新版本。

希望有人能理解并能帮上忙。

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

代码语言:javascript
复制
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
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-04-26 02:56:16

多亏了Deepak Mishra,我现在已经解决了这个问题

代码语言:javascript
复制
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
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/61424387

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档