88code Release #13
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 }} | |
| skip: ${{ steps.version.outputs.skip }} | |
| steps: | |
| - name: Generate date version | |
| id: version | |
| run: | | |
| # Use Beijing timezone for version date | |
| VERSION=$(TZ='Asia/Shanghai' date +%Y.%-m.%-d) | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| echo "Generated version: $VERSION (Beijing date)" | |
| # Check if main package already exists | |
| if npm view @88code/codex@${VERSION} > /dev/null 2>&1; then | |
| echo "skip=true" >> $GITHUB_OUTPUT | |
| echo "⚠️ Version $VERSION already published" | |
| else | |
| echo "skip=false" >> $GITHUB_OUTPUT | |
| fi | |
| build: | |
| needs: version | |
| if: needs.version.outputs.skip != 'true' | |
| 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/[email protected] | |
| 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] | |
| if: needs.version.outputs.skip != 'true' | |
| 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} |