-
Notifications
You must be signed in to change notification settings - Fork 18
66 lines (60 loc) · 2.22 KB
/
build-darwin-arm64.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
name: Build Darwin ARM64
on:
workflow_call:
jobs:
build:
runs-on: macos-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "1.22"
- name: Set environment variables
run: |
MINIWASM_NETWORK_NAME="miniwasm-1"
echo "MINIWASM_NETWORK_NAME=${MINIWASM_NETWORK_NAME}" >> $GITHUB_ENV
WASMVM_VERSION=$(go list -m github.com/CosmWasm/wasmvm/v2 | awk '{print $2}')
echo "WASMVM_VERSION=${WASMVM_VERSION}" >> $GITHUB_ENV
echo "GOARCH=arm64" >> $GITHUB_ENV
echo "GOOS=darwin" >> $GITHUB_ENV
if [[ "${{ github.ref }}" == "refs/tags/"* ]]; then
VERSION=${GITHUB_REF#refs/tags/}
else
VERSION="v0.0.0-${GITHUB_SHA::8}"
fi
echo "VERSION=${VERSION}" >> $GITHUB_ENV
echo "ARCH_NAME=aarch64" >> $GITHUB_ENV
- name: Ensure dependencies
run: |
go mod tidy
go get github.com/CosmWasm/wasmvm/v2@${WASMVM_VERSION}
- name: Print environment variables
run: |
echo "GOARCH=${GOARCH}"
echo "GOOS=${GOOS}"
echo "VERSION=${VERSION}"
echo "ARCH_NAME=${ARCH_NAME}"
echo "MINIWASM_NETWORK_NAME=${MINIWASM_NETWORK_NAME}"
- name: Build and Package for Darwin ARM64
run: |
cd ../miniwasm \
&& make build \
&& cd ./build \
&& ls ~/go/pkg/mod/github.com/ \
&& ls ~/go/pkg/mod/github.com/\!cosm\!wasm/ \
&& cp ~/go/pkg/mod/github.com/\!cosm\!wasm/wasmvm/v2@${WASMVM_VERSION}/internal/api/libwasmvm.dylib ./ \
&& tar -czvf miniwasm_"$VERSION"_Darwin_"$ARCH_NAME".tar.gz ./minitiad libwasmvm.dylib \
&& mv ./miniwasm_"$VERSION"_Darwin_"$ARCH_NAME".tar.gz $GITHUB_WORKSPACE/ \
&& rm -rf ./libwasmvm.dylib ./minitiad
- name: Release
uses: softprops/action-gh-release@v2
with:
files: |
miniwasm_${{ env.VERSION }}_Darwin_${{ env.ARCH_NAME }}.tar.gz
env:
VERSION: ${{ env.VERSION }}
ARCH_NAME: ${{ env.ARCH_NAME }}