Skip to content

Update publish.yml

Update publish.yml #5

Workflow file for this run

name: .NET
on:
push:
branches: [ "main" ]
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore
- name: Pack
run: dotnet pack --include-symbols -c Release -p:SymbolPackageFormat=snupkg -o ${{github.workspace}}/Packages
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: nupkg
path: |
${{github.workspace}}/Packages/*.nupkg
${{github.workspace}}/Packages/*.snupkg ,.
- name: Download Artifact
uses: actions/download-artifact@v4
with:
name: nupkg
path: |
${{github.workspace}}/Packages/*.nupkg
${{github.workspace}}/Packages/*.snupkg
- name: Extract Version
id: extract_version
uses: mavrosxristoforos/[email protected]
with:
xml-file: 'src/SpanExtensions.csproj'
xpath: '/Project//PropertyGroup//Version'
- name: Store Environment Variable
run: echo "VERSION=v${{ steps.extract_version.outputs.info }}" >> $GITHUB_ENV
- name: Download release notes
run: curl -o release-notes.md https://drive.google.com/uc?export=download&id=1LdP8rvPZ9ra4mc4vmv3smcDwVD96Zwn8
- name: Create Tag
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@user.noreply.github.com"
git tag -a ${{ env.VERSION }} -m"${{ env.VERSION }}"
git push origin ${{ env.VERSION }}
- name: Create Release
run: gh release create ${{ env.VERSION }} --title ${{ env.VERSION }} --notes-file release-notes.md ${{github.workspace}}/Packages/*.nupkg ${{github.workspace}}/Packages/*.snupkg
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Push To Nuget
run: dotnet nuget push "${{github.workspace}}/Packages/*.nupkg" -k ${{secrets.NUGET_API_KEY_SPANEXTENSIONS}} -s https://api.nuget.org/v3/index.json --skip-duplicate