Repository navigation
Expand file tree
/
Copy pathaction.yml
More file actions
118 lines (101 loc) · 3.71 KB
/
Copy pathaction.yml
File metadata and controls
118 lines (101 loc) · 3.71 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
name: 'Build OpenLore Binary'
description: 'Build an OpenLore binary with your docs embedded for distribution to AI agents'
branding:
icon: 'book-open'
color: 'blue'
inputs:
docs-dir:
description: 'Path to documentation directory to embed'
required: true
config:
description: 'Path to openlore.yml config file (optional)'
required: false
default: ''
auth:
description: 'Path to lore.json auth config file (optional)'
required: false
default: ''
skills-dir:
description: 'Path to skills directory (optional)'
required: false
default: ''
version-file:
description: 'Path to VERSION file (optional, defaults to auto-generated)'
required: false
default: ''
output-dir:
description: 'Directory for output binaries'
required: false
default: 'dist'
platforms:
description: 'Comma-separated list of GOOS/GOARCH pairs to build'
required: false
default: 'linux/amd64,linux/arm64,darwin/amd64,darwin/arm64,windows/amd64'
binary-name:
description: 'Name for the output binary'
required: false
default: 'openlore'
outputs:
binaries:
description: 'Comma-separated list of built binary paths'
value: ${{ steps.build.outputs.binaries }}
runs:
using: 'composite'
steps:
- name: Install Nix
uses: cachix/install-nix-action@v31
- name: Build dashboard assets
shell: bash
run: nix develop "${{ github.action_path }}" --command make -C "${{ github.action_path }}" dashboard-build
- name: Embed documentation
shell: bash
run: |
# Clear placeholder
rm -rf "${{ github.action_path }}/assets/lore/"*
# Copy docs
cp -r "${{ inputs.docs-dir }}/"* "${{ github.action_path }}/assets/lore/"
# Copy config if provided
if [ -n "${{ inputs.config }}" ] && [ -f "${{ inputs.config }}" ]; then
cp "${{ inputs.config }}" "${{ github.action_path }}/assets/config/openlore.yml"
fi
# Copy auth config if provided
if [ -n "${{ inputs.auth }}" ] && [ -f "${{ inputs.auth }}" ]; then
cp "${{ inputs.auth }}" "${{ github.action_path }}/assets/config/lore.json"
fi
# Copy skills if provided
if [ -n "${{ inputs.skills-dir }}" ] && [ -d "${{ inputs.skills-dir }}" ]; then
cp -r "${{ inputs.skills-dir }}/"* "${{ github.action_path }}/assets/skills/"
fi
# Set version
if [ -n "${{ inputs.version-file }}" ] && [ -f "${{ inputs.version-file }}" ]; then
cp "${{ inputs.version-file }}" "${{ github.action_path }}/assets/config/VERSION"
else
echo "${{ github.sha }}" > "${{ github.action_path }}/assets/config/VERSION"
fi
- name: Build binaries
id: build
shell: bash
run: |
mkdir -p ${{ inputs.output-dir }}
BINARIES=""
IFS=',' read -ra PLATFORMS <<< "${{ inputs.platforms }}"
for platform in "${PLATFORMS[@]}"; do
IFS='/' read -r GOOS GOARCH <<< "$platform"
EXT=""
if [ "$GOOS" = "windows" ]; then
EXT=".exe"
fi
OUTPUT="${{ inputs.output-dir }}/${{ inputs.binary-name }}-${GOOS}-${GOARCH}${EXT}"
echo "Building for ${GOOS}/${GOARCH}..."
cd "${{ github.action_path }}"
nix develop --command env GOOS=$GOOS GOARCH=$GOARCH \
go build -o "${GITHUB_WORKSPACE}/${OUTPUT}" ./cmd/openlore
cd "${GITHUB_WORKSPACE}"
if [ -n "$BINARIES" ]; then
BINARIES="${BINARIES},${OUTPUT}"
else
BINARIES="${OUTPUT}"
fi
done
echo "binaries=${BINARIES}" >> $GITHUB_OUTPUT
echo "Built binaries: ${BINARIES}"