fix(ci): add EGL dependencies for Linux builds #34
Workflow file for this run
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: Release | |
| permissions: | |
| contents: write | |
| packages: write | |
| on: | |
| push: | |
| tags: | |
| - "v*.*.*" # NPM releases: v0.1.0, v1.0.0, etc. | |
| - "[0-9]*.*.*" # NPM releases: 0.1.0, 1.0.0, etc. | |
| workflow_dispatch: | |
| jobs: | |
| build-napi: | |
| name: Build NAPI - ${{ matrix.settings.target }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| settings: | |
| - host: macos-latest | |
| target: x86_64-apple-darwin | |
| - host: macos-latest | |
| target: aarch64-apple-darwin | |
| - host: windows-latest | |
| target: x86_64-pc-windows-msvc | |
| - host: windows-latest | |
| target: i686-pc-windows-msvc | |
| - host: windows-latest | |
| target: aarch64-pc-windows-msvc | |
| - host: ubuntu-latest | |
| target: x86_64-unknown-linux-gnu | |
| use_native: true | |
| runs-on: ${{ matrix.settings.host }} | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: "20" | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 8 | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: stable | |
| targets: ${{ matrix.settings.target }} | |
| components: clippy, rustfmt | |
| - name: Install build dependencies (Linux only) | |
| if: runner.os == 'Linux' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y \ | |
| build-essential \ | |
| musl-tools \ | |
| clang \ | |
| pkg-config \ | |
| libssl-dev \ | |
| libxcb1-dev \ | |
| libxrandr-dev \ | |
| libdbus-1-dev \ | |
| libpipewire-0.3-dev \ | |
| libxi-dev \ | |
| libxtst-dev \ | |
| libxdo-dev \ | |
| libwayland-dev \ | |
| libegl1-mesa-dev \ | |
| libgles2-mesa-dev \ | |
| libgbm-dev \ | |
| libc6-dev \ | |
| linux-libc-dev | |
| - name: Install dependencies | |
| run: pnpm install -r | |
| - name: Build NAPI binary | |
| run: | | |
| cd packages/bot | |
| pnpm napi build --release --esm --const-enum --platform --target ${{ matrix.settings.target }} | |
| shell: bash | |
| - name: List built files | |
| run: ls -la packages/bot/ | |
| shell: bash | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: bindings-${{ matrix.settings.target }} | |
| path: | | |
| packages/bot/*.node | |
| packages/bot/index.js | |
| packages/bot/index.d.ts | |
| if-no-files-found: error | |
| publish-platform-packages: | |
| name: Publish Platform Packages | |
| runs-on: ubuntu-latest | |
| needs: build-napi | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| registry-url: "https://registry.npmjs.org" | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| - name: List all downloaded artifacts | |
| run: | | |
| echo "-- Downloaded artifacts structure --" | |
| ls -laR artifacts/ | |
| - name: Prepare and publish platform packages | |
| run: | | |
| VERSION=$(node -p "require('./packages/bot/package.json').version") | |
| echo "Package version: $VERSION" | |
| # Map target to platform package | |
| declare -A TARGET_MAP | |
| TARGET_MAP["x86_64-apple-darwin"]="darwin-x64" | |
| TARGET_MAP["aarch64-apple-darwin"]="darwin-arm64" | |
| TARGET_MAP["x86_64-pc-windows-msvc"]="win32-x64-msvc" | |
| TARGET_MAP["i686-pc-windows-msvc"]="win32-ia32-msvc" | |
| TARGET_MAP["aarch64-pc-windows-msvc"]="win32-arm64-msvc" | |
| TARGET_MAP["x86_64-unknown-linux-gnu"]="linux-x64-gnu" | |
| for target in "${!TARGET_MAP[@]}"; do | |
| platform="${TARGET_MAP[$target]}" | |
| artifact_dir="artifacts/bindings-$target" | |
| npm_dir="packages/bot/npm/$platform" | |
| echo "Processing $target -> $platform" | |
| if [ -d "$artifact_dir" ]; then | |
| # Find the .node file | |
| node_file=$(find "$artifact_dir" -name "*.node" -type f | head -1) | |
| if [ -n "$node_file" ]; then | |
| # Determine correct binary name | |
| dest_name="bot.$platform.node" | |
| echo " Copying: $node_file -> $npm_dir/$dest_name" | |
| cp -v "$node_file" "$npm_dir/$dest_name" | |
| # Update version in package.json | |
| cd "$npm_dir" | |
| npm version "$VERSION" --no-git-tag-version --allow-same-version || true | |
| # Publish the platform package | |
| echo " Publishing @tego/bot-$platform@$VERSION" | |
| if ! publish_output=$(npm publish --access public 2>&1); then | |
| if echo "$publish_output" | grep -qiE "(already exists|previously published|cannot publish over)"; then | |
| echo " Skipping: Package version already exists" | |
| else | |
| echo " Error: Failed to publish platform package" | |
| echo "$publish_output" | |
| exit 1 | |
| fi | |
| else | |
| echo " Published successfully" | |
| fi | |
| cd - > /dev/null | |
| else | |
| echo " Warning: No .node file found in $artifact_dir" | |
| fi | |
| else | |
| echo " Warning: Artifact directory $artifact_dir not found" | |
| fi | |
| done | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| publish-npm: | |
| name: Publish to NPM | |
| runs-on: ubuntu-latest | |
| needs: | |
| - build-napi | |
| - publish-platform-packages | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| registry-url: "https://registry.npmjs.org" | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 8 | |
| - name: Install dependencies | |
| run: pnpm install -r | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| - name: Copy NAPI index files for main package | |
| run: | | |
| # Copy index.js and index.d.ts from x86_64-unknown-linux-gnu artifact | |
| artifact_dir="artifacts/bindings-x86_64-unknown-linux-gnu" | |
| if [ ! -d "$artifact_dir" ]; then | |
| echo "Error: Artifact directory $artifact_dir not found" | |
| exit 1 | |
| fi | |
| if [ ! -f "$artifact_dir/index.js" ]; then | |
| echo "Error: index.js not found in $artifact_dir" | |
| ls -la "$artifact_dir" || echo "Directory is empty" | |
| exit 1 | |
| fi | |
| if [ ! -f "$artifact_dir/index.d.ts" ]; then | |
| echo "Error: index.d.ts not found in $artifact_dir" | |
| ls -la "$artifact_dir" || echo "Directory is empty" | |
| exit 1 | |
| fi | |
| echo "Copying index files from $artifact_dir" | |
| cp -v "$artifact_dir/index.js" packages/bot/ | |
| cp -v "$artifact_dir/index.d.ts" packages/bot/ | |
| echo "✓ Both index.js and index.d.ts copied successfully" | |
| ls -lh packages/bot/index.* | |
| shell: bash | |
| - name: Verify bot package structure | |
| run: | | |
| echo "-- Bot package contents --" | |
| ls -la packages/bot/ | |
| echo "-- Checking for required files --" | |
| test -f packages/bot/index.js && echo "✓ index.js found" || echo "✗ index.js missing" | |
| test -f packages/bot/index.d.ts && echo "✓ index.d.ts found" || echo "✗ index.d.ts missing" | |
| - name: Build TypeScript packages | |
| run: pnpm ts:build | |
| - name: Publish @tego/bot | |
| run: pnpm publish --access public --no-git-checks | |
| working-directory: packages/bot | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Publish @tego/botjs | |
| run: pnpm publish --access public --no-git-checks | |
| working-directory: packages/botjs | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Publish @tego/bot-agent | |
| run: pnpm publish --access public --no-git-checks | |
| working-directory: packages/bot-agent | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| create-release: | |
| name: Create GitHub Release | |
| runs-on: ubuntu-latest | |
| needs: publish-npm | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Extract version from tag | |
| id: version | |
| run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ github.ref_name }} | |
| name: Release ${{ steps.version.outputs.VERSION }} | |
| body: | | |
| ## 🚀 Tego Bot v${{ steps.version.outputs.VERSION }} | |
| High-performance desktop automation library for Node.js, powered by Rust. | |
| ### Installation | |
| ```bash | |
| npm install @tego/botjs@${{ steps.version.outputs.VERSION }} | |
| # or | |
| pnpm add @tego/botjs@${{ steps.version.outputs.VERSION }} | |
| ``` | |
| ### Electron Support | |
| The package now supports Electron out of the box with prebuilt binaries. | |
| Platform-specific packages are automatically installed via optionalDependencies. | |
| ### Packages | |
| - `@tego/bot@${{ steps.version.outputs.VERSION }}` - Rust core with N-API bindings | |
| - `@tego/botjs@${{ steps.version.outputs.VERSION }}` - TypeScript wrapper (recommended) | |
| - `@tego/bot-agent@${{ steps.version.outputs.VERSION }}` - AI-powered CLI tool | |
| ### Platform Binaries | |
| - `@tego/bot-darwin-x64` - macOS Intel | |
| - `@tego/bot-darwin-arm64` - macOS Apple Silicon | |
| - `@tego/bot-win32-x64-msvc` - Windows x64 | |
| - `@tego/bot-win32-ia32-msvc` - Windows x86 | |
| - `@tego/bot-win32-arm64-msvc` - Windows ARM64 | |
| - `@tego/bot-linux-x64-gnu` - Linux x64 (glibc) | |
| ### What's Changed | |
| See the [CHANGELOG](https://github.com/tegojs/bot/blob/main/CHANGELOG.md) for details. | |
| ### Documentation | |
| - 📖 [Full Documentation](https://tegojs.github.io/bot/) | |
| - 📚 [API Reference](https://tegojs.github.io/bot/api/) | |
| - 🚀 [Getting Started](https://tegojs.github.io/bot/guide/getting-started) | |
| draft: false | |
| prerelease: ${{ contains(github.ref_name, 'alpha') || contains(github.ref_name, 'beta') || contains(github.ref_name, 'rc') }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |