Last active
October 28, 2021 04:08
-
-
Save nenoNaninu/26c5445c493d3458aa6dd88d18130d84 to your computer and use it in GitHub Desktop.
GitHub Actions script for push nuget packages
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: release | |
on: | |
push: | |
tags: | |
- v[0-9]+.[0-9]+.[0-9]+* | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
env: | |
DOTNET_NOLOGO: true | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: '5.0.x' | |
- name: "Get version from git tag" | |
run: echo "Version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV | |
- name: "dotnet build" | |
run: dotnet build -c Release -p:Version=$Version ./path/YourProject.csproj | |
- name: "dotnet pack" | |
run: dotnet pack -c Release --no-build --include-symbols --output $GITHUB_WORKSPACE/artifacts -p:PackageVersion=$Version ./path/YourProject.csproj | |
# Upload artifact | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: Packages | |
path: artifacts | |
- name: "dotnet nuget push" | |
run: dotnet nuget push "$GITHUB_WORKSPACE/artifacts/*.nupkg" --skip-duplicate -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment