-
Notifications
You must be signed in to change notification settings - Fork 1
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
5c477ee
commit 2b2c832
Showing
1 changed file
with
59 additions
and
0 deletions.
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,59 @@ | ||
name: Publish MyGet Package | ||
|
||
on: | ||
push: | ||
tags: | ||
- "v*.*.*" | ||
|
||
run-name: Publish MyGet Package from ${{ github.ref }} | ||
|
||
env: | ||
DOTNET_INSTALL_DIR: "./.dotnet" | ||
|
||
concurrency: | ||
group: workflow-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup .NET | ||
uses: actions/setup-dotnet@v3 | ||
with: | ||
dotnet-version: '8.0.x' | ||
|
||
- name: Cache NuGet Packages | ||
id: nuget-packages | ||
uses: actions/cache@v4 | ||
env: | ||
cache-name: nuget-package-cache | ||
with: | ||
path: ~/.nuget/packages | ||
key: ${{ runner.os }}-${{ env.cache-name }} | ||
|
||
- name: Restore dependencies | ||
run: dotnet restore | ||
|
||
- name: Get the version from git tags | ||
id: get_version | ||
run: | | ||
TAG=$(git describe --tags --abbrev=0) | ||
VERSION=${TAG#v} | ||
echo "VERSION=$VERSION" >> $GITHUB_ENV | ||
- name: Build the project | ||
run: dotnet build --configuration Release --no-restore | ||
|
||
- name: Pack the MyGet package | ||
run: dotnet pack --configuration Release --no-build --output ./nupkg -p:PackageVersion=${{ env.VERSION }} | ||
|
||
- name: Publish the MyGet package | ||
env: | ||
MYGET_URL: ${{ secrets.MYGET_URL }} | ||
MYGET_API_KEY: ${{ secrets.MYGET_API_KEY }} | ||
run: dotnet nuget push ./nupkg/*.nupkg --api-key $MYGET_API_KEY --source $MYGET_URL |