Skip to content

Create new Release

Create new Release #11

name: Create new Release
on:
workflow_dispatch:
inputs:
versionIncrement:
description: 'The new version. For example: 1.1.0'
required: true
default: ''
prerelease:
description: 'Is this a pre-release?'
type: boolean
required: false
default: false
jobs:
release:
name: Publish new release
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4.1.3
with:
token: ${{ secrets.PAT }}
persist-credentials: true
fetch-depth: 0
- name: Get changelog entries
id: changelog
uses: mindsers/changelog-reader-action@v2.2.3
with:
version: Unreleased
path: ./CHANGELOG.md
- name: Setup dotnet
uses: actions/setup-dotnet@v4.0.0
with:
dotnet-version: |
6.0.x
7.0.x
- name: Update CHANGELOG file
uses: thomaseizinger/keep-a-changelog-new-release@3.0.0
with:
version: ${{ github.event.inputs.versionIncrement }}
- name: Set git config
run: |
git config --local user.email "linkdotnet@action.com"
git config --local user.name "LinkDotNet Bot"
- name: Commit changes and push changes
run: |
git add CHANGELOG.md
git commit -m "Update Changelog.md for ${{github.event.inputs.versionIncrement}} release"
git push origin main
- name: Create release on GitHub
uses: thomaseizinger/create-release@1.0.0
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
with:
tag_name: v${{ github.event.inputs.versionIncrement }}
target_commitish: ${{ env.RELEASE_COMMIT_HASH }}
name: v${{ github.event.inputs.versionIncrement }}
body: ${{ steps.changelog.outputs.changes }}
draft: false
prerelease: ${{ github.event.inputs.prerelease }}
- name: Create release package
run: |
dotnet pack -c RELEASE -p:PackageVersion=${{ github.event.inputs.versionIncrement }} --property:PackageOutputPath=${GITHUB_WORKSPACE}/packages /p:ContinuousIntegrationBuild=true --nologo
- name: Upload to nuget
run: |
dotnet nuget push ${GITHUB_WORKSPACE}/packages/*.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json --skip-duplicate