Skip to content

remove old nuget

remove old nuget #7

name: .NET Core Build and Publish
on:
push:
env:
NETCORE_VERSION: '8.0'
GIT_REPO_ROOT: src
MAJOR_MINOR_VERSION: 1.0.
SOLUTION_FILE: CodeCompass.sln
DOTNET_ROLL_FORWARD_ON_NO_CANDIDATE_FX: 2
jobs:
build:
name: Build Package
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Setup .NET Core SDK ${{ env.NETCORE_VERSION }}
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.NETCORE_VERSION }}
- name: Restore
working-directory: ${{ env.GIT_REPO_ROOT }}
run: dotnet restore ${{ env.SOLUTION_FILE }}
- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v1
- name: Build
working-directory: ${{ env.GIT_REPO_ROOT }}
run: dotnet build ${{ env.SOLUTION_FILE }} --configuration Release --no-restore
- name: Pack Release
if: github.ref == 'refs/heads/main'
working-directory: ${{ env.GIT_REPO_ROOT }}
run: |
dotnet pack Agoda.CodeCompass.MSBuild/Agoda.CodeCompass.MSBuild.csproj --configuration Release -o finalpackage --no-build -p:PackageVersion=${{ env.MAJOR_MINOR_VERSION }}${{ github.run_number }}
- name: Pack Preview
if: github.ref != 'refs/heads/main'
working-directory: ${{ env.GIT_REPO_ROOT }}
run: |
dotnet pack Agoda.CodeCompass.MSBuild/Agoda.CodeCompass.MSBuild.csproj --configuration Release -o finalpackage --no-build -p:PackageVersion=${{ env.MAJOR_MINOR_VERSION }}${{ github.run_number }}-preview
- name: Publish artifact
uses: actions/upload-artifact@master
with:
name: nupkg
path: ${{ env.GIT_REPO_ROOT }}/finalpackage
deploy:
needs: build
name: Deploy Packages
runs-on: ubuntu-latest
steps:
- name: Download Package artifact
uses: actions/download-artifact@master
with:
name: nupkg
path: ./nupkg
- name: Setup NuGet
uses: NuGet/[email protected]
with:
nuget-api-key: ${{ secrets.NUGET_API_KEY }}
nuget-version: latest
- name: Setup .NET Core SDK
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.NETCORE_VERSION }}
- name: Push to NuGet
run: dotnet nuget push nupkg/**/*.nupkg -s https://api.nuget.org/v3/index.json -k ${{ secrets.NUGET_API_KEY }} --skip-duplicate
release:
needs: deploy
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- name: Create Draft Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.MAJOR_MINOR_VERSION }}${{ github.run_number }}
release_name: ${{ env.MAJOR_MINOR_VERSION }}${{ github.run_number }}
draft: true
prerelease: false
- uses: eregon/publish-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
release_id: ${{ steps.create_release.outputs.id }}