From 02aa38cc1d1794fc8f17b5e37c938deddf1862f9 Mon Sep 17 00:00:00 2001 From: Andreas Pfohl Date: Fri, 5 Mar 2021 07:56:52 +0100 Subject: [PATCH] Generate package version from Git tag for release --- .github/workflows/ci.yml | 4 +--- .github/workflows/release.yml | 12 ++++++++---- MonadicBits/MonadicBits.csproj | 1 - 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6fd6339..57888e9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,9 +8,7 @@ on: jobs: build: - runs-on: ubuntu-latest - steps: - uses: actions/checkout@v2 - name: Setup .NET @@ -24,7 +22,7 @@ jobs: - name: Test run: dotnet test --no-build --verbosity normal - name: Pack - run: dotnet pack --configuration Release --version-suffix ci-${{ github.run_number }} + run: dotnet pack --configuration Release -p:PackageVersion=${{ github.run_number }}-ci - name: Add Nuget source run: dotnet nuget add source https://nuget.pkg.github.com/bridgefield/index.json -n github -u bridgefield -p ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text - name: Push diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 22c3aa2..da3a1d6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,12 +1,13 @@ name: Release -on: [workflow_dispatch] +on: + push: + tags: + - '*' jobs: build: - runs-on: ubuntu-latest - steps: - uses: actions/checkout@v2 - name: Setup .NET @@ -14,6 +15,9 @@ jobs: with: dotnet-version: 5.0.x - name: Pack - run: dotnet pack --configuration Release + run: | + arrTag=(${GITHUB_REF//\// }) + VERSION="${arrTag[2]}" + dotnet pack -c Release -p:PackageVersion=$VERSION - name: Push run: dotnet nuget push **\*.nupkg -s nuget.org -k ${{ secrets.NUGET_ORG_API_KEY }} diff --git a/MonadicBits/MonadicBits.csproj b/MonadicBits/MonadicBits.csproj index a225da1..6339c41 100644 --- a/MonadicBits/MonadicBits.csproj +++ b/MonadicBits/MonadicBits.csproj @@ -3,7 +3,6 @@ netstandard2.1 bridgefield.MonadicBits - 0.1.0-alpha Andreas Pfohl bridgefield GmbH https://github.com/bridgefield/bits