Skip to content

Rework release workflows using Github runners (replacing Zig) #55

Rework release workflows using Github runners (replacing Zig)

Rework release workflows using Github runners (replacing Zig) #55

name: Make Windows Plugin
on:
push:
paths:
- .github/workflows/make-plugin-windows.yml
pull_request:
paths:
- .github/workflows/make-plugin-windows.yml
workflow_dispatch:
inputs:
version_number:
description: 'Version number'
required: true
default: '2.x.x'
jobs:
build:
strategy:
fail-fast: false
matrix:
os: [windows-2025, windows-11-arm]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Compute VERSION_NUMBER
run: |
INPUT_VERSION="${{ github.event.inputs.version_number }}"
if [ -n "$INPUT_VERSION" ]; then
VERSION="$INPUT_VERSION"
else
VERSION="$GITHUB_REF_NAME"
fi
# Minimal sanitization: replace slashes with dashes to keep filenames valid
VERSION="${VERSION//\//-}"
echo "VERSION_NUMBER=$VERSION" >> "$GITHUB_ENV"
echo "Computed VERSION_NUMBER=$VERSION"
shell: bash
- name: Compute ARCH suffix and artifact name
id: meta
run: |
ARCH=$(uname -m)
case "$ARCH" in
arm64|aarch64)
ARCH_SUFFIX="aarch64"
;;
x86_64|amd64|AMD64)
ARCH_SUFFIX="x86_64"
;;
*)
echo "Unsupported architecture: $ARCH" >&2
exit 1
;;
esac
ARTIFACT="protoc-gen-grpc-web-${VERSION_NUMBER}-windows-${ARCH_SUFFIX}.exe"
echo "ARTIFACT=$ARTIFACT" >> "$GITHUB_ENV"
echo "artifact=$ARTIFACT" >> "$GITHUB_OUTPUT"
echo "Will produce artifact: $ARTIFACT"
shell: bash
- name: Install Bazelisk (Bazel)
shell: powershell
run: |
$arch = [System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture
switch ($arch) {
'Arm64' { $suffix = 'arm64' }
'X64' { $suffix = 'amd64' }
default { Write-Error "Unsupported architecture: $arch"; exit 1 }
}
$url = "https://github.com/bazelbuild/bazelisk/releases/latest/download/bazelisk-windows-$suffix.exe"
$destDir = "$env:RUNNER_TEMP"
$dest = Join-Path $destDir 'bazelisk.exe'
Write-Host "Downloading Bazelisk from $url to $dest"
Invoke-WebRequest -UseBasicParsing -Uri $url -OutFile $dest
# Add to PATH for subsequent steps
$destDir | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Print Bazel version
run: bazelisk version
shell: powershell
- name: Build protoc-gen-grpc-web with Bazel
run: bazelisk build //javascript/net/grpc/web/generator:protoc-gen-grpc-web
shell: powershell
- name: move
run: |
mv bazel-bin/javascript/net/grpc/web/generator/protoc-gen-grpc-web.exe "./${ARTIFACT}"
shell: bash
- name: gen sha256
run: |
openssl dgst -sha256 -r -out "${ARTIFACT}.sha256" "${ARTIFACT}"
shell: bash
# TODO: Check sha256 (sha256sum not available for now.)
#- name: verify sha256
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ steps.meta.outputs.artifact }}
path: protoc-gen-grpc-web*