Update publish.yml #33
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Generate .nupkg file and upload | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
name: Update NuGet package | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v1 | |
- name: Get Latest Tag | |
uses: actions-ecosystem/action-get-latest-tag@v1 | |
id: get-latest-tag | |
- name: Setup .NET Core @ Latest | |
uses: actions/setup-dotnet@v1 | |
with: | |
source-url: https://api.nuget.org/v3/index.json | |
env: | |
NUGET_AUTH_TOKEN: ${{secrets.NUGET_TOKEN}} | |
- name: Build solution and generate NuGet package | |
run: | | |
cp LICENSE.md src/cashfree_pg/ | |
cp README.md src/cashfree_pg/ | |
cd src/cashfree_pg | |
dotnet pack -c Release -o out | |
- name: Push generated package to Nuget registry | |
run: dotnet nuget push ./src/cashfree_pg/out/*.nupkg --api-key ${{secrets.NUGET_TOKEN}} --skip-duplicate --no-symbols | |
- name: Release tags | |
run: | | |
curl --location --request POST 'https://api.github.com/repos/cashfree/cashfree-pg-sdk-dotnet/releases' \ | |
--header 'Accept: application/vnd.github+json' \ | |
--header "Authorization: Bearer ${{ secrets.TOKEN_GITHUB }}" \ | |
--header 'X-GitHub-Api-Version: 2022-11-28' \ | |
--header 'Content-Type: application/json' \ | |
--data-raw '{ | |
"tag_name": "${{ steps.get-latest-tag.outputs.tag }}", | |
"target_commitish": "main", | |
"name": "${{ steps.get-latest-tag.outputs.tag }}", | |
"body": "Release version ${{ steps.get-latest-tag.outputs.tag }}", | |
"draft": false, | |
"prerelease": false, | |
"generate_release_notes": false | |
}' | |