Skip to content

47 multi target

47 multi target #1

Workflow file for this run

name: PUBLISH BETA
on:
workflow_dispatch:
pull_request:
types:
- closed
branches:
- 'development'
- 'dev/**'
- 'fix/**'
- 'bug/**'
- 'hotfix/**'
- 'feat/**'
- 'feature/**'
jobs:
build:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
outputs:
Version: ${{ steps.gitversion.outputs.SemVer }}
CommitsSinceVersionSource: ${{ steps.gitversion.outputs.CommitsSinceVersionSource }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 #fetch-depth is needed for GitVersion
- name: Install GitVersion
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: 5.x
- name: Determine Version
uses: gittools/actions/gitversion/[email protected]
id: gitversion
- name: Display GitVersion outputs
run: |
echo "Version: ${{ steps.gitversion.outputs.SemVer }}"
echo "CommitsSinceVersionSource: ${{ steps.gitversion.outputs.CommitsSinceVersionSource }}"
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.x
- name: Dotnet Restore
run: dotnet restore ./**.sln
- name: Build Source Projects
run: dotnet build ./**.sln -p:Version='${{ steps.gitversion.outputs.SemVer }}' -c Release
- name: Pack NuGet Packages
run: dotnet pack ./**.sln -p:Version='${{ steps.gitversion.outputs.SemVer }}' -c Release -o bin/nugetPackages
- name: Upload NuGet package to GitHub
uses: actions/upload-artifact@v4
with:
name: nugetPackage
path: bin/nugetPackages
release:
if: needs.build.outputs.CommitsSinceVersionSource > 0
runs-on: ubuntu-latest
needs: build
steps:
- name: Download nuget package artifact
uses: actions/download-artifact@v4
with:
name: nugetPackage
path: bin/nugetPackages
- name: Create Release
uses: ncipollo/[email protected]
with:
tag: ${{ needs.build.outputs.Version }}
name: Release ${{ needs.build.outputs.Version }}
body: Released via github actions workflow, see repository README.md
generateReleaseNotes: true
artifacts: "bin/nugetPackages/*.nupkg"
prerelease: true
token: ${{ secrets.GITHUB_TOKEN }}
- name: Push packages to Nuget
run: |
for file in $(find bin/nugetPackages -type f -name "*.nupkg"); do
echo $file
dotnet nuget push $file --api-key "${{ secrets.NUGET_API_KEY }}" --source https://api.nuget.org/v3/index.json --skip-duplicate
done