Skip to content
Open
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
59 changes: 53 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ jobs:
uses: ./
with:
use-installer: true
version: "1.104.0"
- run: sam --version | grep -F 1.104.0
version: "1.159.1"
Comment thread
roger-zhangg marked this conversation as resolved.
- run: sam --version | grep -F 1.159.1

- name: Test official installer (pinned version; should use cache)
uses: ./
with:
use-installer: true
version: "1.104.0"
- run: sam --version | grep -F 1.104.0
version: "1.159.1"
- run: sam --version | grep -F 1.159.1

- name: Test official installer (latest version)
uses: ./
Expand All @@ -56,6 +56,53 @@ jobs:
sam --version | grep -F "$version"
shell: bash

- name: Test official installer (nightly version)
uses: ./
with:
use-installer: true
version: nightly
- run: sam --version

native-installer-windows:
strategy:
fail-fast: false
matrix:
os:
- windows-latest
- windows-2022
name: Native installer (MSI) / ${{ matrix.os }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v6

# Pin to an older version to exercise the downgrade path: GitHub-hosted
# Windows runners ship a recent SAM CLI preinstalled, and Windows
# Installer rejects silent downgrades unless the existing product is
# uninstalled first. This step verifies that uninstall-before-install
# works regardless of which version the runner image happens to ship.
- name: Test MSI installer (pinned version)
uses: ./
with:
use-installer: true
version: "1.139.0"
- run: sam --version | findstr /C:"1.139.0"
shell: cmd

- name: Test MSI installer (latest version)
uses: ./
with:
use-installer: true
- run: sam --version
shell: cmd

- name: Test MSI installer (nightly version)
uses: ./
with:
use-installer: true
version: nightly
- run: sam --version
shell: cmd

integ:
strategy:
fail-fast: false
Expand All @@ -75,8 +122,8 @@ jobs:
runs-on: ${{ matrix.os }}
env:
# Set SAM versions based on Python version
SAM_VERSION: ${{ contains(fromJson('["3.12", "3.13"]'), matrix.python) && '1.128.0' || '1.18.2' }}
INSTALLER_VERSION: ${{ contains( matrix.os, '-arm') && '1.130.0' || '1.71.0' }}
SAM_VERSION: ${{ contains(fromJson('["3.12", "3.13"]'), matrix.python) && '1.159.1' || '1.18.2' }}
INSTALLER_VERSION: "1.159.1"
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
Expand Down
39 changes: 36 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@ Action to set up [AWS SAM CLI](https://docs.aws.amazon.com/serverless-applicatio

This action enables you to run AWS SAM CLI commands in order to build, package, and deploy [serverless applications](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/what-is-sam.html) as part of your workflow.

## Do you need this action?

The AWS SAM CLI is **preinstalled on every GitHub-hosted runner image** (Ubuntu, Windows, and macOS) — see the [`runner-images`](https://github.com/actions/runner-images) repository (e.g. [Ubuntu 24.04](https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2404-Readme.md), [Ubuntu 22.04](https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md), [Windows 2025](https://github.com/actions/runner-images/blob/main/images/windows/Windows2025-Readme.md), [macOS 15](https://github.com/actions/runner-images/blob/main/images/macos/macos-15-Readme.md)) for the exact version shipped with each image. If your workflow only needs the version that comes with the runner, you can call `sam` directly without using this action.

Use this action when you need:

- A **specific version** of the SAM CLI (pinned via the `version` input).
- The **`nightly` release** of the SAM CLI to validate upcoming changes before they ship.
- A consistent SAM CLI version across runner image upgrades.
- The native installer on a runner where SAM CLI is not preinstalled (e.g. self-hosted runners).

## Example

Assuming you have a [`samconfig.toml`](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-config.html) at the root of your repository:
Expand Down Expand Up @@ -38,20 +49,42 @@ jobs:

See [AWS IAM best practices](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html) for handling AWS credentials.

### Installing the nightly release

To validate your project against unreleased changes to the AWS SAM CLI:

```yaml
- uses: aws-actions/setup-sam@v3
with:
use-installer: true
version: nightly
- run: sam --version
```

## Inputs

### `version`

The AWS SAM CLI version to install. Installs the latest version by default.
The AWS SAM CLI version to install. Installs the latest stable version by default.

Accepts:

- An exact version (`x.y.z`, e.g. `1.139.0`) — pinned install.
- A version pattern (`1.*`, `1.139.*`) — only when `use-installer` is `false` (resolved by `pip`).
- `nightly` — installs the latest [nightly release](https://github.com/aws/aws-sam-cli/releases/tag/sam-cli-nightly) of the SAM CLI. Requires `use-installer: true`. Nightly releases are not cached because the `sam-cli-nightly` tag is updated in place each day.

### `use-installer`

> **Note**
>
> This is the recommended approach on supported platforms. It does not require Python to be installed, and is faster than the default installation method.
>
> Currently supports Linux x86-64 and aarch64 (ARM) runners. For ARM architecture, only versions 1.104.0 and above are supported.
> Set to `true` to set up AWS SAM CLI using a native installer. Defaults to `false`.
> Currently supports:
>
> - Linux x86-64 and aarch64 (ARM) — uses the official archive installer. For ARM, only versions 1.104.0 and above are supported.
> - Windows x86-64 — uses the official MSI installer (`AWS_SAM_CLI_64_PY3.msi`).

Set to `true` to set up AWS SAM CLI using a native installer. Defaults to `false`. Required when `version` is set to `nightly`.

### `python`

Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ branding:
color: "orange"
inputs:
version:
description: "The AWS SAM CLI version to install"
description: 'The AWS SAM CLI version to install. Use "nightly" (with use-installer: true) to install the latest nightly release.'
required: false
python:
description: "The Python interpreter to use for AWS SAM CLI"
Expand Down
Loading
Loading