-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8b3c1f5
commit 795ba51
Showing
3 changed files
with
100 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: 'Pack and Publish' | ||
|
||
description: 'Packs and publishes a .NET Library as a build artifact' | ||
|
||
inputs: | ||
projectPath: | ||
description: 'Path to the project file' | ||
required: true | ||
preReleaseVersion: | ||
description: 'The pre-release version to use for the NuGet package' | ||
required: true | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Create PreRelease Artifact | ||
run: dotnet pack ${{ inputs.projectPath }} -c Release --no-build --include-symbols -o ./artifacts/prerelease --version-suffix prerelease-${{ inputs.preReleaseVersion }} | ||
shell: pwsh | ||
|
||
- name: 'Save prerelease artifact' | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: prerelease | ||
path: ./artifacts/prerelease/* | ||
|
||
- name: Create Release Artifact | ||
run: dotnet pack ${{ inputs.projectPath }} -c Release --no-build --include-symbols -o ./artifacts/release | ||
shell: pwsh | ||
|
||
- name: 'Save release artifact' | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: release | ||
path: ./artifacts/release/* |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
name: "Release: Publish to NuGet" | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
reason: | ||
description: "The reason for running the workflow" | ||
required: true | ||
default: "Manual run" | ||
|
||
jobs: | ||
createArtifacts: | ||
name: Generate NuGet Packages | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Setup .NET | ||
uses: actions/setup-dotnet@v3 | ||
with: | ||
global-json-file: global.json | ||
|
||
- name: Install dependencies | ||
run: dotnet restore --locked-mode | ||
|
||
- name: Build Solution | ||
run: dotnet build -c Release --no-restore | ||
|
||
- name: Test Solution | ||
run: dotnet test --configuration Release --no-build --no-restore | ||
|
||
- name: "Pack and Publish" | ||
uses: ./.github/actions/pack-and-publish | ||
with: | ||
projectPath: "./src/templatepack.csproj" | ||
preReleaseVersion: ${{ github.run_number }}-${{ github.run_attempt }} | ||
|
||
publishPreRelease: | ||
name: Publish PreRelease NuGet Package | ||
environment: prerelease | ||
needs: createArtifacts | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Download artifact | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: prerelease | ||
|
||
- name: Publish NuGet Package | ||
run: dotnet nuget push *.nupkg -s https://api.nuget.org/v3/index.json -k ${{ secrets.NUGET_API_KEY }} | ||
|
||
publishRelease: | ||
name: Publish Release NuGet Package | ||
environment: release | ||
needs: [createArtifacts, publishPreRelease] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Download artifact | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: release | ||
|
||
- name: Publish NuGet Package | ||
run: dotnet nuget push *.nupkg -s https://api.nuget.org/v3/index.json -k ${{ secrets.NUGET_API_KEY }} |
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