Skip to content

Improve CI to make sure minimal checks are done before merge #21

Improve CI to make sure minimal checks are done before merge

Improve CI to make sure minimal checks are done before merge #21

Workflow file for this run

name: Pack
on:
pull_request:
push:
branches:
- main
tags:
- "*"
jobs:
pack:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: actions/[email protected]
with:
dotnet-version: 8.0.100
- run: echo "${{ secrets.SNK_FILE }}" | base64 --decode > private.snk
- if: ${{ github.event_name == 'pull_request' }}
run: |
.github/scripts/pack.ps1 `
-OutputPath "pack" `
-PullRequestNumber ${{ github.event.pull_request.number }} `
-KeyPath "$pwd/private.snk"
shell: pwsh
- if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
run: |
$commitMessage = "$(git log -1 --pretty=%B)"
$pattern = "(?<=Merge pull request #)(\d+)"
if (!($commitMessage -match $pattern)) {
Write-Error "Commit message does not contain a pull request number."
}
Remove-Item -Force -Recurse pack -ErrorAction SilentlyContinue
.github/scripts/pack.ps1 `
-OutputPath "pack" `
-PullRequestNumber $matches[1] `
-KeyPath "$pwd/private.snk"
Get-ChildItem -Path pack -Filter "*.nupkg" | ForEach-Object {
dotnet nuget push `
$_ `
--skip-duplicate `
--api-key ${{ secrets.NUGET_API_KEY }} `
--source https://api.nuget.org/v3/index.json
}
shell: pwsh