-
Notifications
You must be signed in to change notification settings - Fork 4
49 lines (42 loc) · 1.64 KB
/
pkg-publish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
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 "developers@cashfree.com"
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