Skip to content

Commit

Permalink
Simplified build
Browse files Browse the repository at this point in the history
  • Loading branch information
Hafeed3s committed Dec 30, 2023
1 parent 43e9675 commit 68bbffe
Showing 1 changed file with 14 additions and 27 deletions.
41 changes: 14 additions & 27 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,34 +27,21 @@ jobs:
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore -c Release
run: |
if [[ "${{ github.ref }}" == refs/tags/* ]]; then
VERSION=$(echo ${GITHUB_REF#refs/tags/})
else
VERSION="0.0.1"
fi
dotnet build --no-restore -c Release -p:Version=$VERSION
- name: Test
run: dotnet test --no-build --verbosity normal -c Release

publish:
- name: Publish NuGet package
if: startsWith(github.ref, 'refs/tags/')
needs: build
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x

- name: Restore dependencies
run: dotnet restore

- name: Build
run: |
VERSION=$(echo ${GITHUB_REF#refs/tags/})
dotnet build --no-restore -c Release -p:Version=$VERSION
- name: Publish NuGet package
run: |
find . -name "SUTForge*.nupkg" -print0 | while IFS= read -r -d '' package
do
echo "Publishing $package"
dotnet nuget push "$package" --api-key "${{ secrets.NUGET_APIKEY }}" --source https://api.nuget.org/v3/index.json --skip-duplicate
done
run: |
find . -name "*.nupkg" -print0 | while IFS= read -r -d '' package
do
echo "Publishing $package"
dotnet nuget push "$package" --api-key "${{ secrets.NUGET_APIKEY }}" --source https://api.nuget.org/v3/index.json --skip-duplicate
done

0 comments on commit 68bbffe

Please sign in to comment.