Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/andrewslotin/go-proxy-pull-action

Pull the new release of a module to the Go proxy cache
https://github.com/andrewslotin/go-proxy-pull-action

documentation go go-modules golang hacktoberfest

Last synced: 8 days ago
JSON representation

Pull the new release of a module to the Go proxy cache

Awesome Lists containing this project

README

        

Go proxy warming action
=======================

This action ensures that a newly released version of a Go module is pulled to the specified proxy.

Each time there is a new tag created in repository with a name that looks like a [semantic version](https://blog.golang.org/publishing-go-modules), the action gets triggered, pulling this version with `go get` via the
configured proxy (https://proxy.golang.org by default).

The action also recognizes the tags that version submodules stored within the same repository,
e.g. `contrib/awesomity/v1.2.3`.

Usage
-----

To renew the documentation on [pkg.go.dev](https://pkg.go.dev) create a new workflow file with following context:

```yaml
on:
release:
types:
- created
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
- '**/v[0-9]+.[0-9]+.[0-9]+'

jobs:
build:
name: Renew documentation
runs-on: ubuntu-latest
steps:
- name: Pull new module version
uses: andrewslotin/go-proxy-pull-action@master
```

This will trigger the action each time whenever a new release is published for a tag that looks either like `vX.Y.Z` or
`submodule/path/vX.Y.Z`.

### Custom proxy

The action accepts `gopath` parameter to specify the URL of a self-hosted or any other Go proxy instead of https://proxy.golang.org. For example to make sure that [GoCenter](https://gocenter.io) has the latest version of your module provide `https://gocenter.io` as a value for `goproxy` parameter:

```yaml
- name: Pull new module version
uses: andrewslotin/go-proxy-pull-action@master
with:
goproxy: https://gocenter.io
```

### Custom import path

In case your module uses custom import path, such as `example.com/myproject`, an attempt to download it using its GitHub reporitory URL will result in an error. In this case you need to provide the import path of your package as an input:

```yaml
- name: Pull new module version
uses: andrewslotin/[email protected]
with:
import_path: example.com/myproject
```

Why?
----

Although the Go module proxies are capable of pulling the missing versions on-demand, there are cases when
this needs to be done before anyone has requested a new version via `go get` through this proxy. An example
would be updating the `pkg.go.dev` documentation of your library upon release.

Currently the [pkg.go.dev](https://pkg.go.dev), unlike [godoc.org](https://godoc.org) does not track new
module versions, displaying the last one it knows about as the latest one. The proposed workaround
[suggests](https://github.com/golang/go/issues/37005#issuecomment-599541549) pulling the new version via
`go get` after it has been released, which is now automated with this GitHub action.

License
-------

The scripts and documentation in this project are released under the [MIT License](LICENSE).