-
Notifications
You must be signed in to change notification settings - Fork 0
148 lines (128 loc) · 4.61 KB
/
release.yaml
File metadata and controls
148 lines (128 loc) · 4.61 KB
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
name: "Build Release"
on:
push:
tags:
- "v*"
permissions: write-all
jobs:
check-version:
runs-on: ubuntu-latest
steps:
- name: Clone Repository
uses: actions/checkout@v4
with:
ref: master
token: ${{ github.token }}
- name: Extract version from tag
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
Build-Linux:
needs: [check-version]
runs-on: ubuntu-20.04
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: 'Install Build Deps'
run: |
sudo apt-get install -y build-essential make cmake git pkg-config
- name: 'Build'
run: |
export BUILD_DATETIME=$(date '+%Y-%m-%d %H:%M:%S.%3N %Z' --date='TZ="Asia/Shanghai" now')
export BUILD_GIT_TAG=v${GITHUB_REF#refs/tags/v}
mkdir prebuilt
go env
CGO_CFLAGS="-I$(pwd)/vm_libvix/include" CGO_LDFLAGS="-L$(pwd)/vm_libvix/libs/linux64 -lvixAllProducts -ldl -lpthread" go build -ldflags "-X 'main.dateTime=$BUILD_DATETIME' -X 'main.gitTag=$BUILD_GIT_TAG' " -o prebuilt/openvm-api cmd/server/main.go
- name: 'Copy RUNTIME'
run: |
# prebuilt/start.sh
echo '#!/bin/bash' > prebuilt/start.sh
echo 'SCRIPT_DIR=$(dirname "$(readlink -f "$0")")' >> prebuilt/start.sh
echo 'LD_LIBRARY_PATH=$SCRIPT_DIR $SCRIPT_DIR/openvm-api' >> prebuilt/start.sh
chmod +x prebuilt/start.sh
# prebuilt/libvixAllProducts.so
cp $(pwd)/vm_libvix/libs/linux64/libvixAllProducts.so prebuilt/
- name: 'Upload artifact'
uses: actions/upload-artifact@v4
with:
name: openvm-api_prebuilt_linux_amd64
path: prebuilt
Build-Windows:
needs: [check-version]
runs-on: windows-latest
defaults:
run:
shell: msys2 {0}
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
cache: false
go-version: '1.20.0'
- name: 'Setup MSYS2'
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: true
cache: false
path-type: 'inherit'
install: >-
git
zip
mingw-w64-x86_64-toolchain
mingw-w64-x86_64-gcc-libs
- name: 'Build'
run: |
export BUILD_DATETIME=$(date '+%Y-%m-%d %H:%M:%S.%3N %Z' --date='TZ="Asia/Shanghai" now')
export BUILD_GIT_TAG=v${GITHUB_REF#refs/tags/v}
mkdir prebuilt
go env
CGO_CFLAGS="-I$(pwd)/vm_libvix/include" CGO_LDFLAGS="-L$(pwd)/vm_libvix/libs/win64 -lvixAllProducts -lpthread" go build -ldflags "-X 'main.dateTime=$BUILD_DATETIME' -X 'main.gitTag=$BUILD_GIT_TAG' " -o prebuilt/openvm-api.exe cmd/server/main.go
- name: 'Copy RUNTIME'
run: |
cp /mingw64/bin/libgcc_s_seh-1.dll prebuilt/
cp /mingw64/bin/libwinpthread-1.dll prebuilt/
cp $(pwd)/vm_libvix/libs/win64/vixAllProducts.dll prebuilt/
- name: 'Upload artifact'
uses: actions/upload-artifact@v4
with:
name: openvm-api_prebuilt_win_amd64
path: prebuilt
release:
needs: [Build-Linux,Build-Windows]
runs-on: ubuntu-latest
steps:
- name: Clone Repository
uses: actions/checkout@v4
with:
submodules: true
ref: master
token: ${{ github.token }}
- name: Download All Artifact
uses: actions/download-artifact@v4
- name: Compress subdirectories
run: |
cd ./openvm-api_prebuilt_win_amd64/
zip -q -r openvm-api_prebuilt_win_amd64.zip *
cd ..
cd ./openvm-api_prebuilt_linux_amd64/
zip -q -r openvm-api_prebuilt_linux_amd64 *
cd ..
rm ./openvm-api_prebuilt_linux_amd64.zip -rf
rm ./openvm-api_prebuilt_win_amd64.zip -rf
mv ./openvm-api_prebuilt_linux_amd64/openvm-api_prebuilt_linux_amd64.zip ./
mv ./openvm-api_prebuilt_win_amd64/openvm-api_prebuilt_win_amd64.zip ./
- name: Extract version from tag
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
- name: Write Changes Log
run: |
echo "v${{ env.VERSION }} RELEASED!" > CHANGELOG.md
- name: Create Release
uses: softprops/action-gh-release@v1
with:
name: v${{ env.VERSION }}
token: ${{ github.token }}
body_path: CHANGELOG.md
files: |
openvm-api_prebuilt_linux_amd64.zip
openvm-api_prebuilt_win_amd64.zip