最近使用的一个 C++ DLL 项目没有官方发布版本,只能自己手搓,实现同步上游更新自动发布版本
直接使用 microsoft/setup-msbuild 即可,示例 workflow 文件如下
name: Publish
on:
workflow_dispatch:
push:
branches: [ branch-name-here ]
paths-ignore:
- '**/**.md'
- '.github/**'
jobs:
publish:
name: Publish the app
runs-on: windows-latest
permissions:
contents: write
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v2
- name: Publish
shell: pwsh
run: |
Set-Location "$env:GITHUB_WORKSPACE"
MSBuild Solution-name.sln /p:configuration=Release /p:platform=x64 /nologo
ls .\path\to\publish\folder
Compress-Archive -Path ".\path\to\publish\folder" -DestinationPath "build.zip"
- name: Create Release
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "latest"
prerelease: false
files: ./build.zip
