forked from openai/codex
-
Notifications
You must be signed in to change notification settings - Fork 0
243 lines (212 loc) · 7.32 KB
/
88code-release.yml
File metadata and controls
243 lines (212 loc) · 7.32 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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
name: 88code Release
on:
workflow_dispatch:
concurrency:
group: 88code-release
cancel-in-progress: true
jobs:
version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- name: Generate date version with build number
id: version
run: |
# Format: YYYY.MMDD.BUILD (semver 3-segment)
# Example: 2025.1204.1 = 2025-12-04 build 1
YEAR=$(TZ='Asia/Shanghai' date +%Y)
MMDD=$(TZ='Asia/Shanghai' date +%m%d)
MMDD=$((10#$MMDD))
DATE_VERSION="${YEAR}.${MMDD}"
echo "Date: $DATE_VERSION"
BUILD=1
while npm view @88code/codex@${DATE_VERSION}.${BUILD} >/dev/null 2>&1; do
echo "${DATE_VERSION}.${BUILD} exists"
BUILD=$((BUILD + 1))
done
VERSION="${DATE_VERSION}.${BUILD}"
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Version: $VERSION"
build:
needs: version
name: Build - ${{ matrix.pkg }}
strategy:
fail-fast: false
matrix:
include:
- runner: macos-15
target: aarch64-apple-darwin
pkg: darwin-arm64
- runner: macos-15-intel
target: x86_64-apple-darwin
pkg: darwin-x64
- runner: ubuntu-24.04
target: x86_64-unknown-linux-musl
pkg: linux-x64
- runner: ubuntu-24.04-arm
target: aarch64-unknown-linux-musl
pkg: linux-arm64
- runner: windows-latest
target: x86_64-pc-windows-msvc
pkg: win32-x64
- runner: windows-11-arm
target: aarch64-pc-windows-msvc
pkg: win32-arm64
runs-on: ${{ matrix.runner }}
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@1.90
with:
targets: ${{ matrix.target }}
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
with:
workspaces: codex-rs -> target
shared-key: ${{ matrix.target }}
save-if: ${{ github.ref == 'refs/heads/main' }}
cache-on-failure: true
cache-all-crates: true
- name: Install musl tools (Linux)
if: contains(matrix.target, 'musl')
run: |
sudo apt-get update
sudo apt-get install -y musl-tools pkg-config
- name: Set version in Cargo.toml
shell: bash
env:
VERSION: ${{ needs.version.outputs.version }}
run: |
sed -i.bak "s/^version = \"0.0.0\"/version = \"${VERSION}\"/" codex-rs/Cargo.toml
echo "Updated Cargo.toml version to ${VERSION}"
- name: Build
working-directory: codex-rs
run: cargo build --target ${{ matrix.target }} --release --bin codex
- name: Stage platform package
shell: bash
env:
VERSION: ${{ needs.version.outputs.version }}
PKG: ${{ matrix.pkg }}
TARGET: ${{ matrix.target }}
run: |
mkdir -p "dist/@88code/codex-${PKG}"
# Create platform package.json
cat > "dist/@88code/codex-${PKG}/package.json" << EOF
{
"name": "@88code/codex-${PKG}",
"version": "${VERSION}",
"description": "88code CLI binary for ${PKG}",
"license": "Apache-2.0",
"os": ["${PKG%%-*}"],
"cpu": ["${PKG##*-}"],
"repository": {
"type": "git",
"url": "git+https://github.com/byebye-code/codex.git"
}
}
EOF
# Copy binary
if [[ "${{ matrix.runner }}" == windows* ]]; then
cp "codex-rs/target/${TARGET}/release/codex.exe" "dist/@88code/codex-${PKG}/"
else
cp "codex-rs/target/${TARGET}/release/codex" "dist/@88code/codex-${PKG}/"
chmod +x "dist/@88code/codex-${PKG}/codex"
fi
echo "=== Package contents ==="
ls -la "dist/@88code/codex-${PKG}/"
cat "dist/@88code/codex-${PKG}/package.json"
- uses: actions/upload-artifact@v4
with:
name: pkg-${{ matrix.pkg }}
path: dist/
publish:
needs: [version, build]
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
path: artifacts
pattern: pkg-*
merge-multiple: true
- name: List downloaded artifacts
run: find artifacts -type f | sort
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v5
with:
node-version: 22
registry-url: 'https://registry.npmjs.org'
- name: Publish platform packages
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
VERSION: ${{ needs.version.outputs.version }}
run: |
for pkg in darwin-arm64 darwin-x64 linux-arm64 linux-x64 win32-arm64 win32-x64; do
PKG_DIR="artifacts/@88code/codex-${pkg}"
if [ -d "$PKG_DIR" ]; then
echo "Publishing @88code/codex-${pkg}@${VERSION}"
cd "$PKG_DIR"
npm publish --access public
cd -
else
echo "⚠️ Package directory not found: $PKG_DIR"
fi
done
- name: Create and publish main package
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
VERSION: ${{ needs.version.outputs.version }}
run: |
mkdir -p main-package/bin
# Create main package.json with optionalDependencies
cat > main-package/package.json << EOF
{
"name": "@88code/codex",
"version": "${VERSION}",
"description": "88code CLI - forked from OpenAI Codex with enhanced features",
"license": "Apache-2.0",
"bin": {
"codex": "bin/codex.js"
},
"type": "module",
"engines": {
"node": ">=16"
},
"files": [
"bin"
],
"repository": {
"type": "git",
"url": "git+https://github.com/byebye-code/codex.git"
},
"keywords": ["codex", "cli", "ai", "coding", "assistant", "88code"],
"optionalDependencies": {
"@88code/codex-darwin-arm64": "${VERSION}",
"@88code/codex-darwin-x64": "${VERSION}",
"@88code/codex-linux-arm64": "${VERSION}",
"@88code/codex-linux-x64": "${VERSION}",
"@88code/codex-win32-arm64": "${VERSION}",
"@88code/codex-win32-x64": "${VERSION}"
}
}
EOF
# Copy the 88code launcher script
cp codex-cli/bin/codex-88code.js main-package/bin/codex.js
echo "=== Main package structure ==="
find main-package -type f | sort
echo "=== package.json ==="
cat main-package/package.json
# Publish main package
cd main-package
echo "Publishing @88code/codex@${VERSION}"
npm publish --access public
- name: Verify publication
env:
VERSION: ${{ needs.version.outputs.version }}
run: |
sleep 10
echo "Verifying @88code/codex@${VERSION}"
npm view @88code/codex@${VERSION}