Merge pull request #53 from cashfree/v4.0.3 #49
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: Publish Go Module to pkg.go.dev | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Get Latest Tag | |
uses: actions-ecosystem/action-get-latest-tag@v1 | |
id: get-latest-tag | |
- name: Set up Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: 1.18 | |
- name: Authenticate with GitHub | |
run: echo "//golang.org/x/oauth2 git https://github.com/golang/oauth2" >> ~/.netrc | |
- name: Publish to Go Module Proxy | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "Cashfree Payments" | |
go mod tidy | |
GOPROXY=proxy.golang.org go list -m github.com/cashfree/cashfree-pg/v4@"${{ steps.get-latest-tag.outputs.tag }}" | |
curl --location --request POST 'https://api.github.com/repos/cashfree/cashfree-pg/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 | |
}' | |
env: | |
GOPROXY: proxy.golang.org |