Skip to content

Commit 1e4a32e

Browse files
committed
fix(ci): compute version number dynamically in MacOS workflow
1 parent 6c23d80 commit 1e4a32e

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

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

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
name: Make MacOS Plugin
22

33
on:
4+
push:
5+
paths:
6+
- .github/workflows/make-plugin-mac-os.yml
7+
pull_request:
8+
paths:
9+
- .github/workflows/make-plugin-mac-os.yml
410
workflow_dispatch:
511
inputs:
612
version_number:
@@ -13,6 +19,17 @@ jobs:
1319
runs-on: macos-14
1420
steps:
1521
- uses: actions/checkout@v3
22+
- name: Compute VERSION_NUMBER
23+
run: |
24+
INPUT_VERSION="${{ github.event.inputs.version_number }}"
25+
if [ -n "$INPUT_VERSION" ]; then
26+
VERSION="$INPUT_VERSION"
27+
else
28+
VERSION="$GITHUB_REF_NAME"
29+
fi
30+
# Minimal sanitization: replace slashes with dashes to keep filenames valid
31+
VERSION="${VERSION//\//-}"
32+
echo "VERSION_NUMBER=$VERSION" >> "$GITHUB_ENV"
1633
- name: Install Bazelisk (Bazel)
1734
run: |
1835
brew update
@@ -25,13 +42,13 @@ jobs:
2542
- name: move
2643
run: |
2744
mv bazel-bin/javascript/net/grpc/web/generator/protoc-gen-grpc-web \
28-
./protoc-gen-grpc-web-${{ github.event.inputs.version_number }}-darwin-x86_64
45+
./protoc-gen-grpc-web-${VERSION_NUMBER}-darwin-x86_64
2946
- name: gen sha256
3047
run: |
31-
openssl dgst -sha256 -r -out protoc-gen-grpc-web-${{ github.event.inputs.version_number }}-darwin-x86_64.sha256 \
32-
protoc-gen-grpc-web-${{ github.event.inputs.version_number }}-darwin-x86_64
48+
openssl dgst -sha256 -r -out protoc-gen-grpc-web-${VERSION_NUMBER}-darwin-x86_64.sha256 \
49+
protoc-gen-grpc-web-${VERSION_NUMBER}-darwin-x86_64
3350
- name: verify sha256
34-
run: shasum -a 256 -c protoc-gen-grpc-web-${{ github.event.inputs.version_number }}-darwin-x86_64.sha256
51+
run: shasum -a 256 -c protoc-gen-grpc-web-${VERSION_NUMBER}-darwin-x86_64.sha256
3552
- name: Upload artifacts
3653
uses: actions/upload-artifact@v4
3754
with:

0 commit comments

Comments
 (0)