Go Go Authentication

Publish Go modules via Git tags

How Go Module Releases Work

Unlike other ecosystems, Go doesn't have a traditional package registry that you push to. Instead:

  1. You create a Git tag (e.g., v1.2.3)
  2. Push the tag to your repository
  3. The Go module proxy (proxy.golang.org) automatically fetches and caches your module
  4. Users can immediately go get your new version

Basic Workflow

Release Pilot handles creating and pushing tags automatically:

permissions:
  contents: write

jobs:
  release:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - uses: a-line-services/release-pilot@v1
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}

Configuration

In your .github/release-pilot.yml:

ecosystem: go
versionFile: go.mod
tagPrefix: v
Version File
Go modules don't store versions in go.mod. Release Pilot uses the file only for ecosystem detection. Versions come entirely from Git tags.

Private Modules

For private repositories, users need to configure their Go environment:

Using GOPRIVATE

# Users of your private module need to set:
go env -w GOPRIVATE=github.com/your-org/*

GitHub Authentication

Users also need Git authentication for private repos:

# Option 1: SSH
git config --global url."git@github.com:".insteadOf "https://github.com/"

# Option 2: Personal Access Token
git config --global url."https://${GITHUB_TOKEN}@github.com/".insteadOf "https://github.com/"

Monorepo / Multi-Module Support

For repositories with multiple Go modules, use submodule prefixes in tags:

# Module at repo root
v1.2.3

# Module in subdirectory "pkg/foo"
pkg/foo/v1.2.3

Configure the tag prefix in Release Pilot:

ecosystem: go
versionFile: pkg/foo/go.mod
tagPrefix: pkg/foo/v

Major Version Branches

Go's module system requires special handling for major versions >= 2:

v2+ Modules
For Go modules v2 and above, you must either:
# go.mod for v2+
module github.com/your-org/your-module/v2

go 1.21

Triggering Proxy Updates

After pushing a tag, the module proxy caches your version when someone first requests it. To pre-warm the cache:

# Add this step after release-pilot
- name: Warm proxy cache
  run: |
    GOPROXY=https://proxy.golang.org go list -m github.com/your-org/your-module@${{ steps.release.outputs.version }}

go.mod Requirements

Minimum Requirements
module github.com/your-org/your-module

go 1.21

Verifying Your Release

After Release Pilot creates a tag, verify it's available:

# Check on pkg.go.dev
https://pkg.go.dev/github.com/your-org/your-module@v1.2.3

# Or via command line
go list -m -versions github.com/your-org/your-module