build: fix build failure when there's no tags in the repo #2
This file contains hidden or 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: Build | |
| on: | |
| pull_request: | |
| branches: [ master ] | |
| workflow_dispatch: | |
| push: | |
| jobs: | |
| build: | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v2 | |
| with: | |
| submodules: 'true' | |
| - name: Build Nuget packages | |
| env: | |
| is_release: ${{ startsWith(github.ref, 'refs/tags/') }} | |
| run: | | |
| ls | |
| pwsh -ep Bypass -c ./tools/publish-nupkg.ps1 $env:is_release | |
| - name: Upload Nuget packages to GitHub registry | |
| if: ${{ github.event_name != 'pull_request' }} | |
| env: | |
| GHPKG_KEY: ${{ secrets.GHPKG_KEY }} | |
| run: | | |
| dotnet nuget add source --username HelloWRC --password $env:GHPKG_KEY --store-password-in-clear-text --name github "https://nuget.pkg.github.com/ClassIsland/index.json" | |
| dotnet nuget push .\out\*.nupkg -k $env:GHPKG_KEY --source "github" --skip-duplicate | |
| - name: Upload Nuget packages to NuGet Gallery | |
| if: ${{ github.event.inputs.release_tag && github.event_name != 'pull_request' }} | |
| env: | |
| NUGET_KEY: ${{ secrets.NUGET_ORG_KEY }} | |
| run: | | |
| ls | |
| cd out | |
| dotnet nuget push *.nupkg -k $env:NUGET_KEY -s https://api.nuget.org/v3/index.json --skip-duplicate |