Quarer v0.2.1-preview1 #14
Workflow file for this run
This file contains 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: | |
workflow_dispatch: | |
release: | |
types: [published] | |
env: | |
DOTNET_CLI_TELEMETRY_OPTOUT: 1 | |
DOTNET_NOLOGO: 1 | |
jobs: | |
pack: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the repository | |
uses: actions/checkout@v4 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 9.x | |
- name: Extract version information | |
id: version-info | |
# expects x.x.x[-previewN] | |
run: | | |
echo "version=$(echo ${{ github.ref_name }} | cut -d "-" -f 1)" >> $GITHUB_OUTPUT | |
echo "full-version=${{ github.ref_name }}" >> $GITHUB_OUTPUT | |
- name: Validate extracted version information | |
run: | | |
if [[ ${{ steps.version-info.outputs.full-version }} =~ ^[[:digit:]]\.[[:digit:]]\.[[:digit:]](-preview([[:digit:]])+)?$ ]]; then | |
echo "Found valid version"; | |
exit 0; | |
else | |
echo "Expected version to match 'x.x.x[-previewN]' got ${{ steps.version-info.outputs.full-version }}"; | |
exit 1; | |
fi | |
- name: Verify package short version matches short version in tag | |
shell: pwsh | |
run: | | |
$version = (Select-String -Pattern "<Version>(\d\.\d\.\d)</Version>" -Path .\src\Quarer\Quarer.csproj).Matches.Groups[1].Value; | |
if ($version -eq "${{ steps.version-info.outputs.version }}") | |
{ | |
Write-Host "Version matches" | |
} | |
else | |
{ | |
Write-Error "Version '$version' does not match expected ref_name version '${{ steps.version-info.outputs.version }}' (from ${{ github.ref_name }})" | |
Exit 1 | |
} | |
- name: Pack | |
run: dotnet pack "src/Quarer/Quarer.csproj" -c Release -o ./pack /p:Version=${{ steps.version-info.outputs.full-version }} | |
- name: Upload package artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: nuget-packages | |
path: ./pack | |
push: | |
needs: pack | |
environment: release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the repository | |
uses: actions/checkout@v4 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 9.x | |
- name: Download package artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: nuget-packages | |
path: ./pack | |
- name: Publish | |
run: dotnet nuget push ./pack/*.nupkg --api-key ${{ secrets.NUGET_KEY }} --source ${{ vars.NUGET_FEED }} |