generated from CubeCraft-Creations/Tracehound
70 lines
1.7 KiB
YAML
70 lines
1.7 KiB
YAML
name: Build (Dev)
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- dev
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
GO_VERSION: "1.23"
|
|
NODE_VERSION: "20"
|
|
BINARY_NAME: openclaw
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: ${{ env.GO_VERSION }}
|
|
|
|
- name: Setup Node
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: ${{ env.NODE_VERSION }}
|
|
|
|
- name: Build React frontend
|
|
working-directory: web
|
|
run: |
|
|
npm ci
|
|
npm run build
|
|
|
|
- name: Embed frontend into Go binary
|
|
run: |
|
|
mkdir -p internal/web/dist
|
|
cp -r web/dist/* internal/web/dist/
|
|
go generate ./internal/web/...
|
|
|
|
- name: Build Go binary
|
|
run: |
|
|
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
|
|
go build -ldflags="-s -w -X main.version=${GITHUB_SHA:0:8}" \
|
|
-o ${{ env.BINARY_NAME }} ./cmd/server
|
|
|
|
- name: Upload build artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ${{ env.BINARY_NAME }}
|
|
path: ${{ env.BINARY_NAME }}
|
|
retention-days: 5
|
|
|
|
- name: Trigger deploy workflow
|
|
if: success()
|
|
uses: actions/github-script@v7
|
|
with:
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
script: |
|
|
await github.rest.repos.createDispatchEvent({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
event_type: 'dev-build-success',
|
|
client_payload: {
|
|
sha: context.sha,
|
|
ref: context.ref
|
|
}
|
|
}) |