-
Notifications
You must be signed in to change notification settings - Fork 208
76 lines (66 loc) · 2.53 KB
/
build-darwin-amd64.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
67
68
69
70
71
72
73
74
75
76
name: Build Darwin AMD64
on:
workflow_call:
jobs:
build:
runs-on: macos-13
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: |
L1_NETWORK_NAME="initiation-1"
echo "L1_NETWORK_NAME=${L1_NETWORK_NAME}" >> $GITHUB_ENV
echo "GOARCH=amd64" >> $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=x86_64" >> $GITHUB_ENV
# Read MOVEVM_VERSION from config file
MOVEVM_VERSION=$(go list -m github.com/initia-labs/movevm | awk '{print $2}')
echo "MOVEVM_VERSION=${MOVEVM_VERSION}" >> $GITHUB_ENV
- name: Ensure dependencies
run: |
go mod tidy
go get github.com/initia-labs/movevm@${MOVEVM_VERSION}
- name: Print environment variables
run: |
echo "GOARCH=${GOARCH}"
echo "GOOS=${GOOS}"
echo "VERSION=${VERSION}"
echo "ARCH_NAME=${ARCH_NAME}"
echo "MOVEVM_VERSION=${MOVEVM_VERSION}"
echo "L1_NETWORK_NAME=${L1_NETWORK_NAME}"
- name: Build and Package for Darwin AMD64
run: |
make build
# Create build directory if not exists
mkdir -p build
# Copy required dylib files
cp "$(go env GOPATH)/pkg/mod/github.com/initia-labs/movevm@${MOVEVM_VERSION}/api/libmovevm.dylib" build/
cp "$(go env GOPATH)/pkg/mod/github.com/initia-labs/movevm@${MOVEVM_VERSION}/api/libcompiler.dylib" build/
# Create archive
cd build && \
tar -czvf "initia_${VERSION}_Darwin_${ARCH_NAME}.tar.gz" \
initiad libmovevm.dylib libcompiler.dylib
# Move archive to workspace and cleanup
mv "initia_${VERSION}_Darwin_${ARCH_NAME}.tar.gz" "${GITHUB_WORKSPACE}/"
rm -f libmovevm.dylib libcompiler.dylib initiad
- name: Release
uses: softprops/action-gh-release@v2
with:
files: |
initia_${{ env.VERSION }}_Darwin_${{ env.ARCH_NAME }}.tar.gz
env:
VERSION: ${{ env.VERSION }}
ARCH_NAME: ${{ env.ARCH_NAME }}