Draft release on master build (#1145)

* remove alpha postfix, releases will increment version

* update the master build job to draft a release

* add publish action to publish full release

* enable setting assembly and file version

* bump assembly and file version for package project

---------

Co-authored-by: BobLd <38405645+BobLd@users.noreply.github.com>
This commit is contained in:
Eliot Jones
2025-09-08 21:07:36 +02:00
committed by GitHub
parent dd5aa46c75
commit 8408c98aec
12 changed files with 114 additions and 12 deletions

View File

@@ -1,4 +1,4 @@
name: Build and test
name: Build, test and publish draft
on:
push:
@@ -10,7 +10,7 @@ jobs:
build:
runs-on: windows-2022
steps:
- uses: actions/checkout@master
- uses: actions/checkout@v4
- name: Set up dotnet core
uses: actions/setup-dotnet@v4
@@ -29,3 +29,14 @@ jobs:
- name: Run the tests
run: dotnet test -c Release src/UglyToad.PdfPig.sln
- name: Update draft release
if: github.ref == 'refs/heads/master'
uses: softprops/action-gh-release@v2
with:
draft: true
name: "Draft release"
tag_name: "unreleased" # fixed tag so this one draft is updated
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

48
.github/workflows/publish_release.yml vendored Normal file
View File

@@ -0,0 +1,48 @@
name: Release Publish
on:
release:
types: [published]
permissions:
contents: write
packages: write
jobs:
build_and_publish_release:
runs-on: windows-2022
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up dotnet core
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
2.1.x
6.0.x
8.0.x
9.0.x
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v2
- name: Run tests
run: dotnet test -c Release src/UglyToad.PdfPig.sln
- name: Build package
run: dotnet pack -c Release -o package tools/UglyToad.PdfPig.Package/UglyToad.PdfPig.Package.csproj -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg
- name: Publish to NuGet
run: dotnet nuget push **/*.nupkg --api-key ${{secrets.NUGET_API_KEY}} --source https://api.nuget.org/v3/index.json
- name: Increment version after release
run: |
$newVer = .\tools\get-next-main-version.ps1
.\tools\set-version.ps1 $newVer -UpdateAssemblyAndFileVersion
git config user.name "github-actions"
git config user.email "github-actions@github.com"
git commit -am "Increment version to $newVer"
git push