From 3d4327a6bb08a26a5ad3f51cc088c6a95e6eec72 Mon Sep 17 00:00:00 2001 From: jamesstocktonj1 Date: Sat, 28 Mar 2026 11:09:11 +0000 Subject: [PATCH 1/4] feat: add setup-componentize-go action --- .../actions/setup-componentize-go/action.yml | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .github/actions/setup-componentize-go/action.yml diff --git a/.github/actions/setup-componentize-go/action.yml b/.github/actions/setup-componentize-go/action.yml new file mode 100644 index 0000000..6c513dd --- /dev/null +++ b/.github/actions/setup-componentize-go/action.yml @@ -0,0 +1,32 @@ +name: 'setup-componentize-go' +description: 'Setup componentize-go for your Github Actions workflow' +author: 'James Stockton' + +inputs: + version: + required: false + description: 'version of componentize-go to setup' + +runs: + using: 'composite' + steps: + - name: Cache componentize-go + uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # 5.0.4 + with: + path: | + ${{ runner.tool_cache }}/componentize-go/${{ inputs.version }} + key: componentize-go-${{ runner.os }}-${{ runner.arch }}-${{ inputs.version }} + - name: Download componentize-go + shell: bash + run: | + bin_name="componentize-go-${{ runner.os }}-${{ runner.arch }}" + + # Download release + curl -LO https://github.com/bytecodealliance/componentize-go/releases/download/${{ inputs.version }}/${bin_name}.tar.gz + tar -xvzf ${bin_name}.tar.gz + + # Add to cache + cache_dir="${{ runner.tool_cache }}/componentize-go/${{ inputs.version }}" + mkdir -p "${cache_dir}" + cp componentize-go "${cache_dir}" + chmod +x "${cache_dir}/componentize-go" \ No newline at end of file From 5ff5fe8cf69ca3c327f3f3a6519dba62963647fe Mon Sep 17 00:00:00 2001 From: jamesstocktonj1 Date: Thu, 2 Apr 2026 23:04:02 +0100 Subject: [PATCH 2/4] fix: update binary name mapping --- .../actions/setup-componentize-go/action.yml | 31 +++++++++++++------ 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/.github/actions/setup-componentize-go/action.yml b/.github/actions/setup-componentize-go/action.yml index 6c513dd..af59232 100644 --- a/.github/actions/setup-componentize-go/action.yml +++ b/.github/actions/setup-componentize-go/action.yml @@ -11,22 +11,35 @@ runs: using: 'composite' steps: - name: Cache componentize-go + id: cache uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # 5.0.4 with: - path: | - ${{ runner.tool_cache }}/componentize-go/${{ inputs.version }} + path: ${{ runner.tool_cache }}/componentize-go/${{ inputs.version }} key: componentize-go-${{ runner.os }}-${{ runner.arch }}-${{ inputs.version }} + - name: Download componentize-go + if: steps.cache.outputs.cache-hit != 'true' shell: bash run: | - bin_name="componentize-go-${{ runner.os }}-${{ runner.arch }}" + case "${{ runner.os }}-${{ runner.arch }}" in + Linux-X64) os="linux"; arch="amd64" ;; + Linux-ARM64) os="linux"; arch="arm64" ;; + macOS-X64) os="darwin"; arch="amd64" ;; + macOS-ARM64) os="darwin"; arch="arm64" ;; + Windows-X64) os="windows"; arch="amd64" ;; + *) echo "Unsupported platform: ${{ runner.os }}-${{ runner.arch }}"; exit 1 ;; + esac - # Download release - curl -LO https://github.com/bytecodealliance/componentize-go/releases/download/${{ inputs.version }}/${bin_name}.tar.gz - tar -xvzf ${bin_name}.tar.gz + archive="componentize-go-${os}-${arch}.tar.gz" + curl -fsSL "https://github.com/bytecodealliance/componentize-go/releases/download/${{ inputs.version }}/${archive}" \ + -o "${archive}" + tar -xzf "${archive}" - # Add to cache cache_dir="${{ runner.tool_cache }}/componentize-go/${{ inputs.version }}" mkdir -p "${cache_dir}" - cp componentize-go "${cache_dir}" - chmod +x "${cache_dir}/componentize-go" \ No newline at end of file + cp componentize-go "${cache_dir}/" + chmod +x "${cache_dir}/componentize-go" + + - name: Add componentize-go to PATH + shell: bash + run: echo "${{ runner.tool_cache }}/componentize-go/${{ inputs.version }}" >> "$GITHUB_PATH" From 2104916a0ee108ff22b72fb2739ab256661e4472 Mon Sep 17 00:00:00 2001 From: jamesstocktonj1 Date: Thu, 2 Apr 2026 23:26:06 +0100 Subject: [PATCH 3/4] fix: windows unzip step --- .../actions/setup-componentize-go/action.yml | 27 ++++++++++++++----- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/.github/actions/setup-componentize-go/action.yml b/.github/actions/setup-componentize-go/action.yml index af59232..f2abf91 100644 --- a/.github/actions/setup-componentize-go/action.yml +++ b/.github/actions/setup-componentize-go/action.yml @@ -17,16 +17,15 @@ runs: path: ${{ runner.tool_cache }}/componentize-go/${{ inputs.version }} key: componentize-go-${{ runner.os }}-${{ runner.arch }}-${{ inputs.version }} - - name: Download componentize-go - if: steps.cache.outputs.cache-hit != 'true' + - name: Download componentize-go (Unix) + if: steps.cache.outputs.cache-hit != 'true' && runner.os != 'Windows' shell: bash run: | case "${{ runner.os }}-${{ runner.arch }}" in - Linux-X64) os="linux"; arch="amd64" ;; - Linux-ARM64) os="linux"; arch="arm64" ;; - macOS-X64) os="darwin"; arch="amd64" ;; - macOS-ARM64) os="darwin"; arch="arm64" ;; - Windows-X64) os="windows"; arch="amd64" ;; + Linux-X64) os="linux"; arch="amd64" ;; + Linux-ARM64) os="linux"; arch="arm64" ;; + macOS-X64) os="darwin"; arch="amd64" ;; + macOS-ARM64) os="darwin"; arch="arm64" ;; *) echo "Unsupported platform: ${{ runner.os }}-${{ runner.arch }}"; exit 1 ;; esac @@ -40,6 +39,20 @@ runs: cp componentize-go "${cache_dir}/" chmod +x "${cache_dir}/componentize-go" + - name: Download componentize-go (Windows) + if: steps.cache.outputs.cache-hit != 'true' && runner.os == 'Windows' + shell: pwsh + run: | + $archive = "componentize-go-windows-amd64.zip" + Invoke-WebRequest ` + -Uri "https://github.com/bytecodealliance/componentize-go/releases/download/${{ inputs.version }}/$archive" ` + -OutFile $archive + Expand-Archive -Path $archive -DestinationPath . + + $cache_dir = "${{ runner.tool_cache }}/componentize-go/${{ inputs.version }}" + New-Item -ItemType Directory -Force -Path $cache_dir | Out-Null + Copy-Item componentize-go.exe "$cache_dir/" + - name: Add componentize-go to PATH shell: bash run: echo "${{ runner.tool_cache }}/componentize-go/${{ inputs.version }}" >> "$GITHUB_PATH" From 2681619291eee6391e2c75f121c31e9a280d5115 Mon Sep 17 00:00:00 2001 From: jamesstocktonj1 Date: Thu, 2 Apr 2026 23:55:20 +0100 Subject: [PATCH 4/4] chore: remove author field --- .github/actions/setup-componentize-go/action.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/actions/setup-componentize-go/action.yml b/.github/actions/setup-componentize-go/action.yml index f2abf91..d30f1e0 100644 --- a/.github/actions/setup-componentize-go/action.yml +++ b/.github/actions/setup-componentize-go/action.yml @@ -1,6 +1,5 @@ name: 'setup-componentize-go' description: 'Setup componentize-go for your Github Actions workflow' -author: 'James Stockton' inputs: version: