Skip to content

release

release #3

Workflow file for this run

name: release
on:
workflow_dispatch:
inputs:
ver:
description: 'The version number, should be specified as a semantic version e.g: X.Y.Z'
required: true
release-notes:
description: 'The versions release notes'
required: true
permissions:
contents: read
env:
DOTNET_VERSION: '8.0'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
repository: benpollarduk/NetAF.Imaging
token: ${{ secrets.PAT }}
- name: Setup environment
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Install dependencies
run: dotnet restore
- name: Update version and release notes in csproj file
run: |
echo "Version: ${{ inputs.ver }}"
echo "Release notes: ${{ inputs.release-notes }}"
# update the .csproj file with the input version
sed -i "s/<Version>.*<\/Version>/<Version>${{ inputs.ver }}<\/Version>/" NetAF.Imaging/NetAF.Imaging.csproj
sed -i "s/<AssemblyVersion>.*<\/AssemblyVersion>/<AssemblyVersion>${{ inputs.ver }}.0<\/AssemblyVersion>/" NetAF.Imaging/NetAF.Imaging.csproj
sed -i "s/<FileVersion>.*<\/FileVersion>/<FileVersion>${{ inputs.ver }}<\/FileVersion>/" NetAF.Imaging/NetAF.Imaging.csproj
# update the .csproj file with the release notes
sed -i "s/<PackageReleaseNotes>.*<\/PackageReleaseNotes>/<PackageReleaseNotes>${{ inputs.release-notes }}<\/PackageReleaseNotes>/" NetAF.Imaging/NetAF.Imaging.csproj
- name: Build
run: dotnet build -c Release
- name: Run tests with coverlet
run: dotnet test /p:CollectCoverage=true /p:CoverletOutput=TestResults/ /p:CoverletOutputFormat=lcov
- name: Tag the commit
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git tag -a "${{ inputs.ver }}" -m "${{ inputs.ver }} tagged during GitHub action"
git push --tags
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Push NuGet package (GitHub)
run: |
dotnet nuget push ./NetAF.Imaging/bin/Release/*.nupkg --api-key ${{ secrets.PAT }} --source https://nuget.pkg.github.com/benpollarduk/index.json
- name: Push NuGet package (NuGet.org)
run: |
dotnet nuget push ./NetAF.Imaging/bin/Release/*.nupkg --api-key ${{ secrets.NUGET_TOKEN }} --source https://api.nuget.org/v3/index.json
- name: Create GitHub release
uses: actions/create-release@v1
with:
tag_name: "${{ inputs.ver }}"
release_name: "${{ inputs.ver }}"
body: "${{ inputs.release-notes }}"
env:
GITHUB_TOKEN: ${{ secrets.PAT }}