ci: add release workflow #52
Workflow file for this run
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: Push NuGet package | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
# Sequence of patterns matched against refs/heads | |
branches: | |
- main | |
jobs: | |
build: | |
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 | |
- name: Build | |
run: | | |
echo "running on $GITHUB_REF_NAME" | |
dotnet build --configuration Release --no-restore | |
- name: Test | |
run: dotnet test --configuration Release --no-build --verbosity normal | |
- name: Pack release | |
if: ${{ github.ref_name == 'main' }} | |
run: dotnet pack --configuration Release --no-build | |
- name: Pack RC | |
if: ${{ github.ref_name != 'main' }} | |
run: dotnet pack --configuration Release --no-build --version-suffix "rc.${GITHUB_RUN_NUMBER}" | |
- name: Push | |
run: dotnet nuget push ./src/N.SourceGenerators.UnionTypes/nupkg/*.nupkg -k ${{ secrets.NUGET_ORG_API_KEY }} -s https://api.nuget.org/v3/index.json --skip-duplicate |