Release 1.0.0-preview.9 (#23) #71
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: | |
push: | |
branches: | |
- main | |
permissions: | |
contents: write | |
jobs: | |
nuget: | |
name: dotnet | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- id: tag | |
name: Determine tag | |
run: | | |
version="$(head -n 1 version.txt)" | |
ref_name="v$version" | |
create=true | |
if [ "$(git ls-remote origin "refs/tags/$ref_name" | wc -l)" = "1" ]; then | |
create=false | |
fi | |
echo "version=$version" | tee -a "$GITHUB_OUTPUT" | |
echo "ref-name=$ref_name" | tee -a "$GITHUB_OUTPUT" | |
echo "create=$create" | tee -a "$GITHUB_OUTPUT" | |
- if: ${{ fromJSON(steps.tag.outputs.create) }} | |
name: Setup dotnet | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: '8.x' | |
- if: ${{ fromJSON(steps.tag.outputs.create) }} | |
name: Pack | |
# https://learn.microsoft.com/en-us/nuget/create-packages/symbol-packages-snupkg | |
# https://devblogs.microsoft.com/dotnet/producing-packages-with-source-link/ | |
run: dotnet pack -c Release -o dist -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg -p:ContinuousIntegrationBuild=true | |
- if: ${{ fromJSON(steps.tag.outputs.create) }} | |
name: Push | |
run: | | |
cd dist | |
ls -lh | |
# this should upload snupkgs in the same folder | |
dotnet nuget push *.nupkg -s https://api.nuget.org/v3/index.json -k "${{ secrets.NUGET_API_KEY }}" --skip-duplicate | |
- if: ${{ fromJSON(steps.tag.outputs.create) }} | |
name: Tag | |
run: | | |
git tag "${{ steps.tag.outputs.ref-name }}" | |
git push origin "${{ steps.tag.outputs.ref-name }}" |