🚀 release #4
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: | |
| release: | |
| types: [published] | |
| jobs: | |
| release: | |
| name: 🚀 release | |
| runs-on: windows-latest | |
| permissions: | |
| contents: read | |
| id-token: write # enable GitHub OIDC token issuance for this job | |
| steps: | |
| - name: 📚 checkout | |
| uses: actions/checkout@v4 | |
| - name: ⚙️ Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: "8.0.x" | |
| - name: 🔓 Decrypt strong-name key | |
| run: bin/EncryptDecryptFile.PS1 | |
| shell: pwsh | |
| env: | |
| SNK_PASSPHRASE: ${{ secrets.SNK_PASSPHRASE }} | |
| SNK_SALT: ${{ secrets.SNK_SALT }} | |
| SNK_INIT: ${{ secrets.SNK_INIT }} | |
| - name: 📝 Update version | |
| run: bin/Update-Version.PS1 -Version "$env:VERSION" | |
| shell: pwsh | |
| env: | |
| VERSION: ${{ github.ref_name }} | |
| - name: 📦 Restore dependencies | |
| run: dotnet restore jmespath.net.sln | |
| - name: 🔨 Build | |
| run: dotnet build jmespath.net.sln --configuration Release --no-restore | |
| - name: 🏗️ Create NuGet packages | |
| run: | | |
| dotnet pack --no-build "src/jmespath.net" -c Release | |
| $targetPath = "src/jmespath.net.parser/bin/Release" | |
| cp "src/jmespath.net.parser/JmesPath.Net.Parser.nuspec" $targetPath | |
| mkdir "$targetPath/lib" | Out-Null | |
| mv "$targetPath/netstandard1.3" "$targetPath/lib/netstandard1.3" | |
| mv "$targetPath/netstandard2.1" "$targetPath/lib/netstandard2.1" | |
| mv "$targetPath/net45" "$targetPath/lib/net45" | |
| cd $targetPath | |
| nuget pack | |
| shell: pwsh | |
| # Use the ambient GitHub token to login to NuGet and retrieve an API key | |
| - name: 🔑 NuGet login (OIDC → temp API key) | |
| # Only push to NuGet if we're building a tag (optional) | |
| if: startsWith(github.ref, 'refs/tags/') | |
| uses: NuGet/login@v1 | |
| id: login | |
| with: | |
| # Secret is your NuGet username, e.g. 'jmespath-community' | |
| user: ${{ secrets.NUGET_USER }} | |
| - name: 📤 Push to NuGet | |
| # Only push to NuGet if we're building a tag (optional) | |
| if: startsWith(github.ref, 'refs/tags/') | |
| shell: pwsh | |
| # Loop through all the packages in the output folder and push them to | |
| # nuget.org, using the NUGET_API_KEY generated by the previous login step | |
| run: | | |
| Get-ChildItem src/ -Filter *.nupkg | ForEach-Object { | |
| dotnet nuget push $_.FullName ` | |
| --api-key "${{ steps.login.outputs.NUGET_API_KEY }}" ` | |
| --source https://api.nuget.org/v3/index.json | |
| } |