Skip to content

Commit 118b793

Browse files
authored
Merge pull request #1796 from 0chain/fix/wasm-build-workflow
2 parents 6aa472a + 0c90567 commit 118b793

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

.github/workflows/build-&-push-normal-wasm.yaml

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
push:
99
# branches: [ master, staging, qa ]
1010
tags:
11-
- 'v*.*.*'
11+
- "v*.*.*"
1212
# pull_request:
1313
workflow_dispatch:
1414

@@ -28,12 +28,22 @@ jobs:
2828
id: wasm_build
2929
run: |
3030
docker run --rm -v $PWD:/gosdk -w /gosdk golang:1.22.5 sh -c "git config --global --add safe.directory /gosdk; make wasm-build"
31-
BUILD_TAG=zcn-$(git describe --tags --exact-match)-normal.wasm
32-
BUILD_TAG="${BUILD_TAG:0:4}${BUILD_TAG:5}"
31+
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
32+
# For manual dispatch, use describe without exact-match or fallback to commit hash
33+
if TAG=$(git describe --tags 2>/dev/null); then
34+
BUILD_TAG=zcn-${TAG}-normal.wasm
35+
else
36+
BUILD_TAG=zcn-$(git rev-parse --short HEAD)-normal.wasm
37+
fi
38+
else
39+
# For tag pushes, use exact-match
40+
BUILD_TAG=zcn-$(git describe --tags --exact-match)-normal.wasm
41+
fi
42+
# BUILD_TAG="${BUILD_TAG:0:4}${BUILD_TAG:5}"
3343
mv zcn.wasm $BUILD_TAG
3444
echo "BUILD_TAG=$BUILD_TAG" >>$GITHUB_OUTPUT
3545
36-
- name: 'Upload Artifact'
46+
- name: "Upload Artifact"
3747
uses: actions/upload-artifact@v4
3848
with:
3949
name: ${{ steps.wasm_build.outputs.BUILD_TAG }}
@@ -43,7 +53,7 @@ jobs:
4353
run: |
4454
sudo apt update -y
4555
sudo apt install awscli -y
46-
56+
4757
- name: Copy the wasm binary to aws s3.
4858
run: |
4959
export AWS_ACCESS_KEY_ID=${{ secrets.WEBAPP_STATIC_ACCESS_KEY }}

0 commit comments

Comments
 (0)