From ef4e6530db8d841a056690a0c8f95b77961e50ef Mon Sep 17 00:00:00 2001 From: thiomajid <82466066+ATOM36@users.noreply.github.com> Date: Sat, 27 Jul 2024 23:58:06 +0100 Subject: [PATCH] fds --- .github/workflows/publish-to-nuget.yml | 51 ++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 .github/workflows/publish-to-nuget.yml diff --git a/.github/workflows/publish-to-nuget.yml b/.github/workflows/publish-to-nuget.yml new file mode 100644 index 0000000..63448cc --- /dev/null +++ b/.github/workflows/publish-to-nuget.yml @@ -0,0 +1,51 @@ +name: CI + +on: + create: + branches: + - release/** + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + build: + + env: + BUILD_CONFIG: 'Release' + SOLUTION: 'EfLight.sln' + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Get Build Version + run: | + Import-Module .\build\GetBuildVersion.psm1 + Write-Host $Env:GITHUB_REF + $version = GetBuildVersion -VersionString $Env:GITHUB_REF + echo "BUILD_VERSION=$version" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append + shell: pwsh + + - name: Setup NuGet + uses: NuGet/setup-nuget@v1.0.5 + + - name: Restore dependencies + run: nuget restore $SOLUTION + + - name: Setup .NET Core SDK ${{ matrix.dotnet-version }} + uses: actions/setup-dotnet@v3 + with: + dotnet-version: 8.0.x + + + - name: Build + run: dotnet build $SOLUTION --configuration $BUILD_CONFIG -p:Version=$BUILD_VERSION --no-restore + + - name: Publish + if: startsWith(github.ref, 'refs/heads/release') + run: nuget push **\*.nupkg -Source 'https://api.nuget.org/v3/index.json' -ApiKey ${{secrets.NUGET_API_KEY}} \ No newline at end of file