Add CI workflows for tag-based release publishing and per-commit DLL builds #1
36
.github/workflows/build-on-commit.yml
vendored
Normal file
36
.github/workflows/build-on-commit.yml
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
name: Build NfcAime.Dll on Commit
|
||||
|
||||
on:
|
||||
push:
|
||||
tags-ignore:
|
||||
- '*'
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: windows-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup NuGet
|
||||
uses: NuGet/setup-nuget@v2
|
||||
|
||||
- name: Setup MSBuild
|
||||
uses: microsoft/setup-msbuild@v2
|
||||
|
||||
- name: Restore NuGet packages
|
||||
run: nuget restore .\\PN532-Aime-Reader.sln
|
||||
|
||||
- name: Build NfcAime.Dll (x64, no project references)
|
||||
run: msbuild .\\src\\NfcAime.Dll\\NfcAime.Dll.csproj /p:Configuration=Release /p:Platform="Any CPU" /p:PlatformTarget=x64 /p:BuildProjectReferences=false
|
||||
|
|
||||
|
||||
- name: Upload build artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: NfcAime.Dll-${{ github.sha }}
|
||||
path: src/NfcAime.Dll/bin/Release/NfcAime.Dll.dll
|
||||
if-no-files-found: error
|
||||
67
.github/workflows/release-on-tag.yml
vendored
Normal file
67
.github/workflows/release-on-tag.yml
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
name: Build and Release NfcAime.Dll on Tag
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- '*'
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
build-and-release:
|
||||
runs-on: windows-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup NuGet
|
||||
uses: NuGet/setup-nuget@v2
|
||||
|
||||
- name: Setup MSBuild
|
||||
uses: microsoft/setup-msbuild@v2
|
||||
|
||||
- name: Restore NuGet packages
|
||||
run: nuget restore .\\PN532-Aime-Reader.sln
|
||||
|
||||
- name: Build NfcAime.Dll (x64, no project references)
|
||||
run: msbuild .\\src\\NfcAime.Dll\\NfcAime.Dll.csproj /p:Configuration=Release /p:Platform="Any CPU" /p:PlatformTarget=x64 /p:BuildProjectReferences=false
|
||||
|
The MSBuild invocation passes This issue also appears on line 41 of the same file. The MSBuild invocation passes `/p:Platform="Any CPU"`, but `NfcAime.Dll.csproj` uses `AnyCPU` (no space) in its configuration conditions (e.g., `Release|AnyCPU`). With `Platform="Any CPU"`, the intended Release property group may not apply (Optimize/DefineConstants/OutputPath), and the built DLL may not match the expected settings. Prefer removing `/p:Platform` entirely (letting the project default to AnyCPU) or set `/p:Platform=AnyCPU`.
This issue also appears on line 41 of the same file.
|
||||
|
||||
- name: Generate commit notes since previous tag
|
||||
shell: pwsh
|
||||
run: |
|
||||
$currentTag = "${{ github.ref_name }}"
|
||||
$prevTag = git tag --sort=-creatordate | Where-Object { $_ -ne $currentTag } | Select-Object -First 1
|
||||
|
||||
if ($prevTag) {
|
||||
$range = "$prevTag..$currentTag"
|
||||
$commitTitle = "## Commits since $prevTag"
|
||||
} else {
|
||||
$range = $currentTag
|
||||
$commitTitle = "## Commits in $currentTag"
|
||||
}
|
||||
|
||||
$commits = git log $range --pretty=format:"- %s (%h)"
|
||||
if (-not $commits) {
|
||||
$commits = "- No commits found."
|
||||
}
|
||||
|
||||
@"
|
||||
## Build Artifact
|
||||
- NfcAime.Dll.dll (Release, PlatformTarget=x64)
|
||||
|
||||
$commitTitle
|
||||
$commits
|
||||
"@ | Out-File -FilePath RELEASE_NOTES.md -Encoding utf8
|
||||
|
||||
- name: Create GitHub Release and upload DLL
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
tag_name: ${{ github.ref_name }}
|
||||
body_path: RELEASE_NOTES.md
|
||||
files: |
|
||||
src/NfcAime.Dll/bin/Release/NfcAime.Dll.dll
|
||||
fail_on_unmatched_files: true
|
||||
Reference in New Issue
Block a user
Same issue as the release workflow:
/p:Platform="Any CPU"likely won’t match the project’sRelease|AnyCPUcondition inNfcAime.Dll.csproj. This can lead to a non-Release configuration being effectively used and/or output landing somewhere other than the expectedbin/Releasepath. Remove/p:Platformor change it to/p:Platform=AnyCPU.