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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ jobs:
id: test-action-with-version
uses: ./
with:
wash-version: "wash-v2.0.0-rc.8"
wash-version: "v2.0.1"
12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@

This action installs the [wash](https://github.com/wasmCloud/wasmCloud) CLI, a tool for developing and managing WebAssembly (Wasm) components with [wasmCloud](https://wasmcloud.com/).

> **_NOTE:_** This action sets up the next version of `wash` which does not yet have a stable 2.0 release.

## Usage

Add the following step to your workflow to install `wash`:
Expand All @@ -16,14 +14,14 @@ Add the following step to your workflow to install `wash`:
- name: Setup wash CLI
uses: wasmCloud/setup-wash-action@main
with:
wash-version: wash-v2.0.0-rc.8 # Optional
wash-version: v2.0.1 # Optional
```

### Inputs

| Name | Description | Default |
| ------------ | ------------------------------------------------------------------------- | ---------------- |
| wash-version | The version of wash to install. Note this uses tags until 2.0 is released | wash-v2.0.0-rc.8 |
| Name | Description | Default |
| ------------ | ------------------------------ | ------- |
| wash-version | The version of wash to install | v2.0.1 |

## Example Workflow

Expand All @@ -40,7 +38,7 @@ jobs:
- name: Setup wash CLI
uses: wasmCloud/setup-wash-action@main
with:
wash-version: wash-v2.0.0-rc.8
wash-version: v2.0.1
- name: Check wash version
run: wash --version
```
37 changes: 8 additions & 29 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ branding:
# Define your inputs here.
inputs:
wash-version:
description: "The version of wash to install (default: latest), Examples: wash-v2.0.0-rc.8, latest, 0.51, 0.51.1, ^0.51, ~0.51"
description: "The version of wash to install (default: latest), Examples: v2.0.1, wash-v2.0.0-rc.8, latest, 0.51, 0.51.1, ^0.51, ~0.51"
required: false
default: "wash-v2.0.0-rc.8"
default: "v2.0.1"

runs:
using: "composite"
Expand All @@ -34,47 +34,26 @@ runs:
if: steps.wash-cache.outputs.cache-hit != 'true' && runner.os != 'Windows'
env:
GITHUB_TOKEN: ${{ github.token }}
WASH_VERSION: ${{ inputs.wash-version }}
INSTALL_DIR: ${{ runner.tool_cache }}/wash/${{ inputs.wash-version }}
run: |
set -euo pipefail

wash_version="${{ inputs.wash-version }}"
wash_cache_dir="${RUNNER_TOOL_CACHE}/wash/${wash_version}"

echo "Installing wash ${wash_version}"

# Install wash using the official install script with verification
export WASH_VERSION="${wash_version}"
echo "Installing wash ${WASH_VERSION}"
curl -sSL https://wasmcloud.com/sh | bash -s -- -v

# Add to tool cache
mkdir -p "${wash_cache_dir}"
cp ./wash "${wash_cache_dir}/wash"
chmod +x "${wash_cache_dir}/wash"

echo "wash installed and cached successfully"

- name: Install wash CLI (Windows)
shell: pwsh
if: steps.wash-cache.outputs.cache-hit != 'true' && runner.os == 'Windows'
env:
GITHUB_TOKEN: ${{ github.token }}
WASH_VERSION: ${{ inputs.wash-version }}
INSTALL_DIR: ${{ runner.tool_cache }}/wash/${{ inputs.wash-version }}
run: |
$ErrorActionPreference = 'Stop'

$wash_version = "${{ inputs.wash-version }}"
$wash_cache_dir = "$env:RUNNER_TOOL_CACHE\wash\$wash_version"

Write-Host "Installing wash $wash_version"

# Install wash using the official PowerShell install script with verification
$env:WASH_VERSION = $wash_version
Write-Host "Installing wash $env:WASH_VERSION"
$installScript = Invoke-WebRequest -Uri "https://wasmcloud.com/ps1" -UseBasicParsing
Invoke-Expression "& { $($installScript.Content) } -Verify"

# Add to tool cache
New-Item -ItemType Directory -Force -Path $wash_cache_dir | Out-Null
Copy-Item -Path ".\wash.exe" -Destination "$wash_cache_dir\wash.exe"

Write-Host "wash installed and cached successfully"

- name: Add wash to PATH
Expand Down
Loading