Skip to content

Commit

Permalink
Add/wasm release (#1729)
Browse files Browse the repository at this point in the history
* added workflow to release gosdk with version

* added depth cloning

* checkout to release version

* checkout to release version

* debug checkout issue

* debug checkout issue

* fix wasm build

* fix wasm build

* upload binary to actions

* add steps to deploy wasm to s3

* added binary deployment to cdn

* fixed release trigger

* updated file name

* cleanup
  • Loading branch information
shahnawaz-creator authored Jan 8, 2025
1 parent f93a045 commit 5467083
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/build-&-push-normal-wasm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Build & Push Normal Wasm

concurrency:
group: "build-release-wasm-${{ github.ref }}"
cancel-in-progress: true

on:
push:
# branches: [ master, staging, qa ]
tags:
- 'v*.*.*'
# pull_request:
workflow_dispatch:

jobs:
build-wasm:
name: Build-wasm
runs-on: [self-hosted, arc-runner]
outputs:
build_version: ${{ steps.wasm_build.outputs.BUILD_TAG }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Build wasm binary using go version 1.22.5
id: wasm_build
run: |
docker run --rm -v $PWD:/gosdk -w /gosdk golang:1.22.5 sh -c "git config --global --add safe.directory /gosdk; make wasm-build"
BUILD_TAG=zcn-$(git describe --tags --exact-match)-normal.wasm
BUILD_TAG="${BUILD_TAG:0:4}${BUILD_TAG:5}"
mv zcn.wasm $BUILD_TAG
echo "BUILD_TAG=$BUILD_TAG" >>$GITHUB_OUTPUT
- name: 'Upload Artifact'
uses: actions/upload-artifact@v4
with:
name: ${{ steps.wasm_build.outputs.BUILD_TAG }}
path: ${{ steps.wasm_build.outputs.BUILD_TAG }}

- name: Install AWS cli
run: |
sudo apt update -y
sudo apt install awscli -y
- name: Copy the wasm binary to aws s3.
run: |
export AWS_ACCESS_KEY_ID=${{ secrets.WEBAPP_STATIC_ACCESS_KEY }}
export AWS_SECRET_ACCESS_KEY=${{ secrets.WEBAPP_STATIC_SECRET_ACCESS_KEY }}
export AWS_DEFAULT_REGION=${{ secrets.WEBAPP_STATIC_REGION }}
gzip -9 ${{ steps.wasm_build.outputs.BUILD_TAG }} && mv ${{ steps.wasm_build.outputs.BUILD_TAG }}.gz ${{ steps.wasm_build.outputs.BUILD_TAG }}
aws s3 cp ${{ steps.wasm_build.outputs.BUILD_TAG }} s3://${{ secrets.WEBAPP_STATIC_BUCKET }}/wasm/${{ steps.wasm_build.outputs.BUILD_TAG }} --content-encoding gzip
- name: Invalidate wasm binary
run: |
export AWS_ACCESS_KEY_ID=${{ secrets.WEBAPP_STATIC_ACCESS_KEY }}
export AWS_SECRET_ACCESS_KEY=${{ secrets.WEBAPP_STATIC_SECRET_ACCESS_KEY }}
export AWS_DEFAULT_REGION=${{ secrets.WEBAPP_STATIC_REGION }}
aws cloudfront create-invalidation --distribution-id ${{ secrets.WEBAPP_STATIC_DISTRIBUTION_ID }} --paths '/wasm/*'

0 comments on commit 5467083

Please sign in to comment.