Skip to content

added new json

added new json #4

Workflow file for this run

name: Publish Go Module
on:
push:
tags:
- '*'
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16 # Choose the Go version you need
- name: Authenticate with GitHub
run: echo "//golang.org/x/oauth2 git https://github.com/golang/oauth2" >> ~/.netrc
- name: Publish to Go Module Proxy
run: |
go list -m
go test -v ./...
go list -m all
go mod tidy
go list -m -json all | jq -r .Path > golist.txt
MODULE_NAME=$(cat golist.txt)
git tag -l --points-at HEAD | xargs -I@ -n 1 echo "//proxy.golang.org/${MODULE_NAME} => @#latest" >> gomod.txt
echo -e "$(cat gomod.txt)\n$(cat go.mod)" > go.mod
git add go.mod go.sum
git commit -m "Publishing module"
git push origin HEAD:main
env:
GOPROXY: proxy.golang.org