Skip to content

Commit c60ba35

Browse files
committed
IDEA! - refactor(build): enhance MacOS plugin workflow with architecture support and update checkout action
1 parent d6a3f15 commit c60ba35

File tree

1 file changed

+32
-7
lines changed

1 file changed

+32
-7
lines changed

.github/workflows/make-plugin-mac-os.yml

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,13 @@ on:
1616

1717
jobs:
1818
build:
19-
runs-on: macos-14
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
os: [macos-13, macos-14]
23+
runs-on: ${{ matrix.os }}
2024
steps:
21-
- uses: actions/checkout@v3
25+
- uses: actions/checkout@v4
2226
- name: Compute VERSION_NUMBER
2327
run: |
2428
INPUT_VERSION="${{ github.event.inputs.version_number }}"
@@ -31,6 +35,27 @@ jobs:
3135
VERSION="${VERSION//\//-}"
3236
echo "VERSION_NUMBER=$VERSION" >> "$GITHUB_ENV"
3337
echo "Computed VERSION_NUMBER=$VERSION"
38+
- name: Compute ARCH suffix and artifact name
39+
id: meta
40+
run: |
41+
ARCH=$(uname -m)
42+
case "$ARCH" in
43+
arm64)
44+
ARCH_SUFFIX="aarch64"
45+
;;
46+
x86_64)
47+
ARCH_SUFFIX="x86_64"
48+
;;
49+
*)
50+
echo "Unsupported architecture: $ARCH" >&2
51+
exit 1
52+
;;
53+
esac
54+
ARTIFACT="protoc-gen-grpc-web-${VERSION_NUMBER}-darwin-${ARCH_SUFFIX}"
55+
echo "ARTIFACT=$ARTIFACT" >> "$GITHUB_ENV"
56+
echo "arch_suffix=$ARCH_SUFFIX" >> "$GITHUB_OUTPUT"
57+
echo "artifact=$ARTIFACT" >> "$GITHUB_OUTPUT"
58+
echo "Will produce artifact: $ARTIFACT"
3459
- name: Install Bazelisk (Bazel)
3560
run: |
3661
brew update
@@ -43,15 +68,15 @@ jobs:
4368
- name: move
4469
run: |
4570
mv bazel-bin/javascript/net/grpc/web/generator/protoc-gen-grpc-web \
46-
./protoc-gen-grpc-web-${VERSION_NUMBER}-darwin-x86_64
71+
./${ARTIFACT}
4772
- name: gen sha256
4873
run: |
49-
openssl dgst -sha256 -r -out protoc-gen-grpc-web-${VERSION_NUMBER}-darwin-x86_64.sha256 \
50-
protoc-gen-grpc-web-${VERSION_NUMBER}-darwin-x86_64
74+
openssl dgst -sha256 -r -out ${ARTIFACT}.sha256 \
75+
${ARTIFACT}
5176
- name: verify sha256
52-
run: shasum -a 256 -c protoc-gen-grpc-web-${VERSION_NUMBER}-darwin-x86_64.sha256
77+
run: shasum -a 256 -c ${ARTIFACT}.sha256
5378
- name: Upload artifacts
5479
uses: actions/upload-artifact@v4
5580
with:
56-
name: plugin
81+
name: ${{ steps.meta.outputs.artifact }}
5782
path: protoc-gen-grpc-web*

0 commit comments

Comments
 (0)