Skip to content

feat: Create setup-same GitHub Action #68

@drlucaa

Description

@drlucaa

Create a new GitHub Action, setup-same, to automate the installation and configuration of the same binary in CI/CD pipelines. This action will allow users to easily onboard same into their workflows without manually managing release downloads or path configuration.

This action will be published to the Marketplace and used in user workflows (e.g., .github/workflows/ci.yml).

Goals

  • Provide a seamless "zero-config" experience for installing the latest version of same.
  • Support deterministic builds by allowing users to pin specific versions.
  • Optimize CI performance by leveraging the GitHub Actions tool cache.
  • Support all platforms currently targeted by our release pipeline (Linux/macOS, amd64/arm64).

Acceptance Criteria

Interface

  • Inputs
    • version: (Optional) The version to install (e.g., v0.0.1, 0.0.1). Defaults to latest.
    • github-token: (Optional) Used to query the GitHub API to avoid rate limits. Defaults to ${{ github.token }}.
  • Outputs
    • version: The actual version number installed.
    • cache-hit: Boolean (true/false) indicating if the binary was served from the local cache.

Functional Logic

  • Platform Detection: Automatically detect the runner's OS and Architecture.
    • Support: Linux, macOS.
    • Support: amd64 (x64), arm64.
    • Note: Windows is explicitly not supported.
  • Version Resolution:
    • If latest is requested, query the GitHub Releases API to find the most recent tag.
    • If a specific version is provided, use it directly.
    • Sanitize the version string to ensure correct filename construction (stripping v prefix if necessary).
  • Asset Download:
    • Construct the download URL based on the goreleaser naming convention found in release.yml: same_{VERSION}_{OS}_{ARCH}.tar.gz.
    • Mappings:
      • Linux → linux
      • macOS → macOS (Case sensitive)
      • amd64 → x86_64
      • arm64 → arm64
  • Installation:
    • Download and extract the archive.
    • Install the binary into the runner's tool cache using @actions/tool-cache.
    • Prepend the binary path to $GITHUB_PATH.
  • Verification:
    • Execute same --version to verify the installation was successful.

Implementation Details

  • Built using Node.js 20.
  • Uses @actions/core, @actions/tool-cache, and @actions/http-client.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions