Skip to content

.Build and Generate .NET Package #23

.Build and Generate .NET Package

.Build and Generate .NET Package #23

Workflow file for this run

name: .Build and Generate .NET Package
on:
workflow_dispatch:
inputs:
version:
description: 'Specify the version'
required: true
jobs:
build:
runs-on: ubuntu-latest
permissions: # Job-level permissions configuration starts here
contents: write # 'write' access to repository contents
pull-requests: write
steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore
- name: Update Version in .csproj
run: |
version=${{ github.event.inputs.version }}
sed -i "s/<Version>.*<\/Version>/<Version>$version<\/Version>/" src/xi.sdk.resellers/xi.sdk.resellers.csproj
git config --global user.email "${{ secrets.ADMIN_EMAIL }}"
git config --global user.name "${{ secrets.ORG_NAME }}"
git add .
if git diff --exit-code; then
echo "No changes to commit."
else
git commit -m "Update version in .csproj" || true
git push https://${{ secrets.WORKFLOW_TOKEN }}@github.com/ingrammicro-xvantage/xi-sdk-resellers-csharp.git test_package
fi
- name: Build Package
run: dotnet pack -c Release --output github-package/ --version-suffix $(date +"%Y%m%d%H%M%S")
- name: Commit and Push Package
run: |
git config --global user.email "${{ secrets.ADMIN_EMAIL }}"
git config --global user.name "${{ secrets.ORG_NAME }}"
git add github-package/*.nupkg
git commit -m "Add NuGet package" || true
git pull
git push https://${{secrets.WORKFLOW_TOKEN}}@github.com/ingrammicro-xvantage/xi-sdk-resellers-csharp.git main