Skip to content

Commit

Permalink
fix workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
genusP committed Dec 13, 2024
1 parent 33a4235 commit f6ccc43
Showing 1 changed file with 41 additions and 42 deletions.
83 changes: 41 additions & 42 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
inputs:
prerelease:
default: true
description: Set as pre-release
type: boolean
required: true
push:
Expand All @@ -16,58 +17,56 @@ on:
description: Push to nuget.org

push:
branches: [ "main" ]
branches: ["master"]

jobs:
publish:

runs-on: ubuntu-latest
env:
PackageOutputDir: ".packages"
Prerelease: ${{ github.event.inputs.prerelease || 'false' }}
PushPackage: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/master') || github.event.inputs.push }}

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x

- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v3.0.0
with:
versionSpec: '6.0.5'

- name: Determine Version
run: |
${GITVERSION_PATH}/dotnet-gitversion /output buildserver /output json
- name: Pack
run: |
dotnet pack --nologo -o ${PackageOutputDir} \
-p:PackageVersion=${GitVersion_SemVer} \
-p:AssemblyVersion=${GitVersion_AssemblySemFileVer} \
-p:FileVersion=${GitVersion_MajorMinorPatch} \
-p:AssemblyVersion=${GitVersion_AssemblySemVer} \
-p:FileVersion=${GitVersion_MajorMinorPatch} \
-p:Configuration=Release
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x

- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v3.0.0
with:
versionSpec: "6.0.5"

- name: Determine Version
run: |
${GITVERSION_PATH}/dotnet-gitversion /output buildserver /output json
- name: Nuget Push
if: env.PushPackage == 'true'
working-directory: ${{ env.PackageOutputDir }}
run: dotnet nuget push *.nupkg -s https://api.nuget.org/v3/index.json -k ${{secrets.NUGET_API_KEY}}
- name: Pack
run: |
dotnet pack --nologo -o ${PackageOutputDir} \
-p:PackageVersion=${GitVersion_SemVer} \
-p:AssemblyVersion=${GitVersion_AssemblySemFileVer} \
-p:FileVersion=${GitVersion_MajorMinorPatch} \
-p:AssemblyVersion=${GitVersion_AssemblySemVer} \
-p:FileVersion=${GitVersion_MajorMinorPatch} \
-p:Configuration=Release
- name: Create Release
uses: ncipollo/release-action@v1
with:
name: v${{ env.GitVersion_SemVer }}
tag: v${{ env.GitVersion_SemVer }}
artifacts: ${{ env.PackageOutputDir }}/*.nupkg
generateReleaseNotes: true
commit: ${{ env.GitVersion_Sha}}
prerelease: ${{ env.Prerelease }}
- name: Nuget Push
if: env.PushPackage == 'true'
working-directory: ${{ env.PackageOutputDir }}
run: dotnet nuget push *.nupkg -s https://api.nuget.org/v3/index.json -k ${{secrets.NUGET_API_KEY}}

- name: Create Release
uses: ncipollo/release-action@v1
with:
name: v${{ env.GitVersion_SemVer }}
tag: v${{ env.GitVersion_SemVer }}
artifacts: ${{ env.PackageOutputDir }}/*.nupkg
generateReleaseNotes: true
commit: ${{ env.GitVersion_Sha}}
prerelease: ${{ env.Prerelease }}

0 comments on commit f6ccc43

Please sign in to comment.