Skip to content

Commit 2104916

Browse files
fix: windows unzip step
1 parent 5ff5fe8 commit 2104916

1 file changed

Lines changed: 20 additions & 7 deletions

File tree

.github/actions/setup-componentize-go/action.yml

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,15 @@ runs:
1717
path: ${{ runner.tool_cache }}/componentize-go/${{ inputs.version }}
1818
key: componentize-go-${{ runner.os }}-${{ runner.arch }}-${{ inputs.version }}
1919

20-
- name: Download componentize-go
21-
if: steps.cache.outputs.cache-hit != 'true'
20+
- name: Download componentize-go (Unix)
21+
if: steps.cache.outputs.cache-hit != 'true' && runner.os != 'Windows'
2222
shell: bash
2323
run: |
2424
case "${{ runner.os }}-${{ runner.arch }}" in
25-
Linux-X64) os="linux"; arch="amd64" ;;
26-
Linux-ARM64) os="linux"; arch="arm64" ;;
27-
macOS-X64) os="darwin"; arch="amd64" ;;
28-
macOS-ARM64) os="darwin"; arch="arm64" ;;
29-
Windows-X64) os="windows"; arch="amd64" ;;
25+
Linux-X64) os="linux"; arch="amd64" ;;
26+
Linux-ARM64) os="linux"; arch="arm64" ;;
27+
macOS-X64) os="darwin"; arch="amd64" ;;
28+
macOS-ARM64) os="darwin"; arch="arm64" ;;
3029
*) echo "Unsupported platform: ${{ runner.os }}-${{ runner.arch }}"; exit 1 ;;
3130
esac
3231
@@ -40,6 +39,20 @@ runs:
4039
cp componentize-go "${cache_dir}/"
4140
chmod +x "${cache_dir}/componentize-go"
4241
42+
- name: Download componentize-go (Windows)
43+
if: steps.cache.outputs.cache-hit != 'true' && runner.os == 'Windows'
44+
shell: pwsh
45+
run: |
46+
$archive = "componentize-go-windows-amd64.zip"
47+
Invoke-WebRequest `
48+
-Uri "https://github.com/bytecodealliance/componentize-go/releases/download/${{ inputs.version }}/$archive" `
49+
-OutFile $archive
50+
Expand-Archive -Path $archive -DestinationPath .
51+
52+
$cache_dir = "${{ runner.tool_cache }}/componentize-go/${{ inputs.version }}"
53+
New-Item -ItemType Directory -Force -Path $cache_dir | Out-Null
54+
Copy-Item componentize-go.exe "$cache_dir/"
55+
4356
- name: Add componentize-go to PATH
4457
shell: bash
4558
run: echo "${{ runner.tool_cache }}/componentize-go/${{ inputs.version }}" >> "$GITHUB_PATH"

0 commit comments

Comments
 (0)