Skip to content

Release

Release #57

Workflow file for this run

name: Release
on:
workflow_dispatch:
inputs:
version:
description: 'Version'
required: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Get version from input
id: tag_name
shell: pwsh
env:
INPUT_VERSION: ${{ github.event.inputs.version }}
run: |
$current_version = $env:INPUT_VERSION.StartsWith('v') ? $env:INPUT_VERSION.Substring(1) : $env:INPUT_VERSION
echo "current_version=$current_version" >> $env:GITHUB_OUTPUT
- uses: actions/checkout@v3
- name: Print Debug Info
run: dotnet --info
- name: Restore dependencies
run: dotnet restore
- name: Pack
# https://learn.microsoft.com/en-us/dotnet/core/project-sdk/msbuild-props#packrelease
env:
DOTNET_CLI_ENABLE_PACK_RELEASE_FOR_SOLUTIONS: true
run: dotnet pack -c Release --no-restore -p:Version="${{ steps.tag_name.outputs.current_version }}" -p:RepositoryBranch=${{ github.ref_name }} -p:RepositoryCommit="${{ github.sha }}"
- name: Get Changelog Entry
id: changelog_reader
uses: mindsers/changelog-reader-action@v2
with:
version: ${{ steps.tag_name.outputs.current_version }}
path: ./CHANGELOG.md
- name: Push to NuGet
run: dotnet nuget push **/*.nupkg --skip-duplicate --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json
- name: Push to GitHub Packages
run: dotnet nuget push **/*.nupkg --skip-duplicate --api-key ${{ secrets.GITHUB_TOKEN }} --source https://nuget.pkg.github.com/erri120/index.json
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.changelog_reader.outputs.version }}
name: Release ${{ steps.changelog_reader.outputs.version }}
body: ${{ steps.changelog_reader.outputs.changes }}
draft: ${{ steps.changelog_reader.outputs.status == 'unreleased' }}
prerelease: ${{ steps.changelog_reader.outputs.status == 'prereleased' }}