Skip to content

Commit 351fcbd

Browse files
committed
ci: should setup go in build
1 parent ad00bc8 commit 351fcbd

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

scripts/build.mts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { $ } from 'zx'
22

33
// Build Go service
4+
await setupGo()
5+
46
console.log('Building Go service...')
57
const ldflags = `-s -w -X 'logic.version=${new Date().toISOString().slice(0, 10).replace(/-/g, '')}' -X 'logic.appBaseUrl=http://uni-token.app'`
68
const releaseDir = 'frontend/public/release'
@@ -27,3 +29,22 @@ console.log('Building frontend...')
2729
await $`pnpm -C frontend build`
2830

2931
console.log('Build complete! Files are in frontend/dist/')
32+
33+
async function setupGo() {
34+
try {
35+
console.log('Checking Go installation...')
36+
await $`go version`
37+
console.log('Go is already installed.')
38+
return
39+
}
40+
catch {
41+
console.log('Go is not installed, proceeding with installation...')
42+
}
43+
44+
await $`curl -LO https://go.dev/dl/go1.25.0.linux-amd64.tar.gz`
45+
await $`rm -rf /usr/local/go`
46+
await $`tar -C /usr/local -xzf go1.25.0.linux-amd64.tar.gz`
47+
await $`echo 'export PATH=$PATH:/usr/local/go/bin' >> $HOME/.profile`
48+
await $`source $HOME/.profile`
49+
await $`go version`
50+
}

0 commit comments

Comments
 (0)