Update to dotnet10 #19
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: "Deploy to NuGet" | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| env: | |
| PACKAGE_OUTPUT_DIR: ${{ github.workspace }}/output | |
| permissions: | |
| contents: write | |
| jobs: | |
| deploy: | |
| name: 'Deploy' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: 8.0.x | |
| - name: Generate CalVer Version | |
| id: versioning | |
| run: | | |
| # Format: YYYY.MMDD.RunNumber | |
| DATE_PREFIX=$(date +'%Y.%-m%d') | |
| git fetch --tags | |
| REVISION=$(git tag -l "v${DATE_PREFIX}.*" | wc -l | xargs) | |
| VERSION="${DATE_PREFIX}.${REVISION}" | |
| echo "VERSION=$VERSION" >> $GITHUB_OUTPUT | |
| echo "Generated Version: $VERSION" | |
| - name: Restore dependencies | |
| run: dotnet restore | |
| - name: Build | |
| run: dotnet build --no-restore --configuration Release | |
| - name: Pack | |
| run: dotnet pack --no-restore --no-build --configuration Release /p:Version=${{ steps.versioning.outputs.VERSION }} --output ${{ env.PACKAGE_OUTPUT_DIR }} | |
| - name: Create Git Tag | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git tag v${{ steps.versioning.outputs.VERSION }} | |
| git push origin v${{ steps.versioning.outputs.VERSION }} | |
| - name: Upload Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: nuget-package | |
| path: ${{ env.PACKAGE_OUTPUT_DIR }}/*.nupkg | |
| - name: Push to NuGet | |
| run: dotnet nuget push ${{ env.PACKAGE_OUTPUT_DIR }}/*.nupkg -k ${{ secrets.NUGET_AUTH_TOKEN }} -s https://api.nuget.org/v3/index.json --skip-duplicate |