publish #1
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: publish | |
| on: | |
| release: | |
| types: [ published ] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| packages: write | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install GitVersion | |
| uses: gittools/actions/gitversion/setup@bc6623af8fc07d5a8903052dd46da33403eec8e8 # v4.5.0 | |
| with: | |
| versionSpec: '6.3.x' | |
| - name: Determine Version | |
| id: version_step | |
| uses: gittools/actions/gitversion/execute@bc6623af8fc07d5a8903052dd46da33403eec8e8 # v4.5.0 | |
| - name: Setup dotnet | |
| uses: actions/setup-dotnet@9a946fdbd5fb07b82b2f5a4466058b876ab72bb2 # v5.3.0 | |
| with: | |
| dotnet-version: '10.0.x' | |
| - name: Restore | |
| run: dotnet restore | |
| # AssemblyVersion must stay numeric, so it gets assemblySemVer rather than the | |
| # NuGet version (which may carry a prerelease suffix). | |
| - name: Build | |
| run: > | |
| dotnet build --configuration Release --no-restore | |
| -p:Version=${{ steps.version_step.outputs.nuGetVersionV2 }} | |
| -p:AssemblyVersion=${{ steps.version_step.outputs.assemblySemVer }} | |
| -p:FileVersion=${{ steps.version_step.outputs.assemblySemFileVer }} | |
| -p:InformationalVersion=${{ steps.version_step.outputs.fullSemVer }} | |
| - name: Test | |
| run: dotnet test --configuration Release --no-build --verbosity normal | |
| - name: Pack | |
| run: > | |
| dotnet pack --configuration Release --no-build | |
| -o ${{ runner.temp }}/nupkgs | |
| -p:Version=${{ steps.version_step.outputs.nuGetVersionV2 }} | |
| - name: Push to GitHub Packages | |
| run: > | |
| dotnet nuget push "${{ runner.temp }}/nupkgs/*.nupkg" | |
| --source https://nuget.pkg.github.com/OpenShock/index.json | |
| --api-key ${{ secrets.GITHUB_TOKEN }} | |
| --skip-duplicate |