Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 29 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# Exercises the action itself (this repo's whole reason to exist) across every runner OS it
# claims to support. Pinned to a real getsotto/sotto tag rather than "latest" - matches the
# action's own no-implicit-latest posture.
# Exercises the action itself (this repo's whole reason to exist) across every release target it
# supports. macos-latest is ARM64, so macos-15-intel covers the separate x86_64 release; likewise,
# ubuntu-24.04-arm covers Linux ARM64 alongside the default x86_64 Ubuntu runner.
#
# The test is pinned to a real getsotto/sotto tag rather than "latest", matching the action's own
# no-implicit-latest posture.
# v0.4.0 is the first getsotto/sotto release with Windows and Linux ARM64 artifacts (v0.3.0 and
# earlier predate that work), so this is also the first version this test can actually pass
# against on windows-latest.
Expand Down Expand Up @@ -37,15 +39,32 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
include:
- runner: ubuntu-latest
target: x86_64-unknown-linux-gnu
- runner: ubuntu-24.04-arm
target: aarch64-unknown-linux-gnu
- runner: macos-latest
target: aarch64-apple-darwin
- runner: macos-15-intel
target: x86_64-apple-darwin
- runner: windows-latest
target: x86_64-pc-windows-msvc
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v4
- uses: ./
- id: sotto
name: Install sotto
uses: ./
with:
sotto-version: ${{ env.SOTTO_TEST_VERSION }}
- name: sotto --version actually reports the pinned version
- name: Check the installed version and outputs
shell: bash
env:
OUTPUT_VERSION: ${{ steps.sotto.outputs.version }}
OUTPUT_TARGET: ${{ steps.sotto.outputs.target }}
OUTPUT_BINARY_PATH: ${{ steps.sotto.outputs.binary-path }}
EXPECTED_TARGET: ${{ matrix.target }}
run: |
set -euo pipefail
actual="$(sotto --version)"
Expand All @@ -55,3 +74,6 @@ jobs:
echo "expected '$actual' to equal '$expected'" >&2
exit 1
fi
test "$OUTPUT_VERSION" = "$SOTTO_TEST_VERSION"
test "$OUTPUT_TARGET" = "$EXPECTED_TARGET"
test -f "$OUTPUT_BINARY_PATH"
30 changes: 25 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,33 @@ values - that stays entirely under your workflow's control via `sotto run --` /
`sotto-version` is **required** - there is no implicit "latest", so a new Sotto release can never
silently change your CI's behaviour. Pin it the same way you'd pin any other tool version.

Works across `ubuntu-latest`, `macos-latest`, and `windows-latest` runners: internally this
downloads the archive for the selected release, verifies its checksum and Sigstore signature, and
checks that the installed binary reports the requested version. Signature verification is
mandatory: a missing or invalid bundle fails the job rather than falling back to a checksum-only
install. The verification identity is pinned to the selected tag of Sotto's release workflow; see
The action supports x86_64 and ARM64 Linux, x86_64 and ARM64 macOS, and x86_64 Windows.
Internally it downloads the archive for the selected release, verifies its checksum and Sigstore
signature, and checks that the installed binary reports the requested version. Signature
verification is mandatory: a missing or invalid bundle fails the job rather than falling back to
a checksum-only install. The verification identity is pinned to the selected tag of Sotto's
release workflow; see
[SECURITY.md](https://github.com/getsotto/sotto/blob/main/SECURITY.md) for the release model.

## Outputs

Give the step an `id` to use the resolved installation details in later steps:

```yaml
- uses: getsotto/sotto-action@v1
id: sotto
with:
sotto-version: v0.4.0

- run: echo "installed ${{ steps.sotto.outputs.version }} for ${{ steps.sotto.outputs.target }}"
```

| Output | Description | macOS example | Windows example |
| --- | --- | --- | --- |
| `version` | Selected release tag | `v0.4.0` | `v0.4.0` |
| `target` | Resolved release target | `aarch64-apple-darwin` | `x86_64-pc-windows-msvc` |
| `binary-path` | Absolute installed binary path | `/Users/runner/work/_temp/sotto-bin/sotto` | `D:\a\_temp\sotto-bin\sotto.exe` |

## Versioning

This action is tagged independently of the `sotto` CLI's own version (`v0.1.0`, `v0.2.0`, ...) -
Expand Down
14 changes: 14 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,18 @@ inputs:
new Sotto release can never silently change your CI's behaviour.
required: true

outputs:
# Exactly one platform install step runs. Select the output from whichever step was not skipped.
version:
description: "The installed Sotto release tag"
value: ${{ steps.install-unix.outputs.version || steps.install-windows.outputs.version }}
target:
description: "The installed Sotto release target"
value: ${{ steps.install-unix.outputs.target || steps.install-windows.outputs.target }}
binary-path:
description: "The absolute path to the installed Sotto binary"
value: ${{ steps.install-unix.outputs.binary-path || steps.install-windows.outputs.binary-path }}

runs:
using: "composite"
steps:
Expand Down Expand Up @@ -44,6 +56,7 @@ runs:
install-dir: ${{ runner.temp }}/cosign

- name: Install sotto (Linux/macOS)
id: install-unix
if: runner.os != 'Windows'
shell: bash
env:
Expand All @@ -52,6 +65,7 @@ runs:
run: '"${{ github.action_path }}/scripts/install.sh"'

- name: Install sotto (Windows)
id: install-windows
if: runner.os == 'Windows'
shell: pwsh
env:
Expand Down
3 changes: 3 additions & 0 deletions scripts/install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ try {
}

$InstallDir | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
"version=$Version" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
"target=$Target" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
"binary-path=$BinaryPath" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append

Write-Host "installed $BinaryPath"
} finally {
Expand Down
5 changes: 5 additions & 0 deletions scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -110,5 +110,10 @@ expected="sotto ${version#v}"
fail "installed binary reported '$actual', expected '$expected'"

printf '%s\n' "$install_dir" >>"$GITHUB_PATH"
{
printf 'version=%s\n' "$version"
printf 'target=%s\n' "$target"
printf 'binary-path=%s\n' "$install_dir/sotto"
} >>"$GITHUB_OUTPUT"

say "installed $install_dir/sotto"
Loading