Add NuGet package link #2
Workflow file for this run
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: Release | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: "Package version, for example 0.1.0" | |
| required: true | |
| permissions: | |
| contents: read | |
| id-token: write | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| environment: nuget | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: 10.0.x | |
| - name: Verify release comes from master | |
| shell: bash | |
| run: | | |
| git fetch origin master | |
| git merge-base --is-ancestor "$GITHUB_SHA" origin/master | |
| - name: Resolve version | |
| id: version | |
| shell: bash | |
| run: | | |
| if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then | |
| echo "value=${{ inputs.version }}" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "value=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Restore | |
| run: dotnet restore Notion2Ical.sln | |
| - name: Build | |
| run: dotnet build Notion2Ical.sln --configuration Release --no-restore | |
| - name: Test | |
| run: dotnet test Notion2Ical.sln --configuration Release --no-build --verbosity normal | |
| - name: Pack | |
| run: dotnet pack Notion2Ical/Notion2Ical.csproj --configuration Release --no-build --output artifacts /p:PackageVersion=${{ steps.version.outputs.value }} | |
| - name: NuGet login | |
| uses: NuGet/login@v1 | |
| id: login | |
| with: | |
| user: ${{ vars.NUGET_USER }} | |
| - name: Push to NuGet | |
| run: dotnet nuget push artifacts/*.nupkg --api-key ${{ steps.login.outputs.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate |