Files
actions-go/README.md

2.2 KiB

actions-go

Reusable Gitea Actions for Go projects.

actions/go-cache

Composite action that installs Go, installs tailscale/go-cache-plugin, and configures Go's native GOCACHEPROG to cache Go build and test artifacts in an S3-compatible backend.

This action avoids the need to tar/untar huge build directories manually and leverages standard S3 object storage for fast, reliable caching.

S3 usage

Create an S3 bucket for your Go build cache, then pass S3 settings as inputs and credentials as normal workflow environment variables or secrets.

For ease of use and compatibility with actions-rust, the action automatically maps SCCACHE_AWS_ACCESS_KEY_ID and SCCACHE_AWS_SECRET_ACCESS_KEY to standard AWS environment variables if they are provided.

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Setup Go + S3 Caching
        uses: https://git.ericxliu.me/eric/actions-go/.gitea/actions/go-cache@main
        with:
          go-version: '1.24'
          s3-bucket: my-go-cache-bucket
          s3-endpoint: https://s3.example.com
          s3-path-style: "true"
        env:
          SCCACHE_AWS_ACCESS_KEY_ID: ${{ secrets.SCCACHE_AWS_ACCESS_KEY_ID }}
          SCCACHE_AWS_SECRET_ACCESS_KEY: ${{ secrets.SCCACHE_AWS_SECRET_ACCESS_KEY }}
          AWS_REGION: auto

      - run: go test -v ./...

Local usage

Omit s3-bucket to fall back to the default setup-go action's local caching behavior:

- name: Setup Go (local cache)
  uses: https://git.ericxliu.me/eric/actions-go/.gitea/actions/go-cache@main
  with:
    go-version: '1.24'

Inputs

  • go-version: Go version to install. Defaults to stable.
  • cache: Set to "false" to opt-out of all caching setup.
  • go-cache-plugin-version: Specific version tag or latest of the cache plugin. Defaults to latest.
  • s3-bucket: S3 bucket name. Empty means local caching only.
  • s3-endpoint: Optional S3-compatible endpoint URL (e.g., self-hosted MinIO or Ceph).
  • s3-path-style: Set to "true" for endpoints requiring path-style addressing (e.g., MinIO).
  • cache-dir: Local cache directory for caching. Defaults to ~/.cache/go-cache.