gh action fix #70
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Our.Umbraco.Iconic - Release | |
on: | |
push: | |
branches: [ master, v14 ] | |
env: | |
SOLUTION: Iconic.sln | |
PLUGIN_PROJECT: Our.Iconic/Our.Iconic.csproj | |
CORE_PROJECT: Our.Iconic.Core/Our.Iconic.Core.csproj | |
OUTPUT_PATH: ${{ github.workspace }}/build.out | |
jobs: | |
publish-nuget: | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Get Release Version | |
id: package_version | |
uses: KageKirin/get-csproj-version@v0 | |
with: | |
file: ${{ env.PLUGIN_PROJECT }} | |
regex: ^(?<major>0|[1-9]\d*)\.(?<minor>0|[1-9]\d*)\.(?<patch>0|[1-9]\d*)(?:-(?<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?<buildmetadata>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$ | |
- name: Check Version v${{ steps.package_version.outputs.version }} Pre-Release state | |
id: check_prerelease | |
run: | | |
if [ ${{ steps.package_version.outputs.version }} =~ ^[0-9]+\.[0-9]+\.[0-9]+-.+$ ]; then | |
echo Pre-Release detected | |
echo ::set-output name=prerelease::true | |
else | |
echo Pre-Release NOT detected | |
echo ::set-output name=prerelease::false | |
fi | |
- name: Restore dependencies | |
run: dotnet restore | |
- run: dotnet build --configuration Release | |
- name: Create Nuget Packages | |
run: dotnet pack --configuration Release -o ${{ env.OUTPUT_PATH }} | |
- name: Publish to NuGet | |
working-directory: ${{ env.OUTPUT_PATH }} | |
run: dotnet nuget push *.nupkg --skip-duplicate --api-key ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json | |
- uses: avakar/tag-and-release@v1 | |
name: Create Release Tag v${{ steps.package_version.outputs.version }} | |
id: release | |
with: | |
tag_name: v${{ steps.package_version.outputs.version }} | |
prerelease: ${{ steps.check_prerelease.outputs.prerelease }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Release information for v${{ steps.package_version.outputs.version }} | |
run: | | |
echo Release Id: ${{ steps.release.outputs.id }} | |
echo Upload URL: ${{ steps.release.outputs.upload_url }} | |
echo Release URL: ${{ steps.release.outputs.html_url }} |