Build Haxe Language Server Binaries #1
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: Build Haxe Language Server Binaries | |
| on: | |
| push: | |
| branches: [main, master] | |
| pull_request: | |
| branches: [main, master] | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| name: Build (${{ matrix.os }}) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [windows-latest, ubuntu-latest, macos-latest] | |
| steps: | |
| - name: Checkout repository with submodules | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| - name: Install dependencies | |
| run: npm install | |
| - name: Install pkg | |
| run: npm install -g pkg | |
| # ── Windows ──────────────────────────────────────────────────────────── | |
| - name: Build binaries (Windows) | |
| if: runner.os == 'Windows' | |
| shell: bash | |
| run: | | |
| mkdir -p bin/win | |
| pkg language-servers/haxe/server.js --targets node22-win-x64 --output bin/win/haxe-language-server-x64 | |
| pkg language-servers/haxe/server.js --targets node22-win-arm64 --output bin/win/haxe-language-server-arm64 | |
| - name: Zip artifacts (Windows) | |
| if: runner.os == 'Windows' | |
| shell: bash | |
| run: | | |
| cd bin/win | |
| 7z a haxe-language-server-win-x64.zip haxe-language-server-x64.exe | |
| 7z a haxe-language-server-win-arm64.zip haxe-language-server-arm64.exe | |
| - name: Upload Windows x64 | |
| if: runner.os == 'Windows' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: haxe-language-server-win-x64 | |
| path: bin/win/haxe-language-server-win-x64.zip | |
| - name: Upload Windows arm64 | |
| if: runner.os == 'Windows' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: haxe-language-server-win-arm64 | |
| path: bin/win/haxe-language-server-win-arm64.zip | |
| # ── Linux ────────────────────────────────────────────────────────────── | |
| - name: Build binaries (Linux) | |
| if: runner.os == 'Linux' | |
| run: | | |
| mkdir -p bin/linux | |
| pkg language-servers/haxe/server.js --targets node22-linuxstatic-x64 --output bin/linux/haxe-language-server-x64 | |
| pkg language-servers/haxe/server.js --targets node22-linuxstatic-arm64 --output bin/linux/haxe-language-server-arm64 | |
| pkg language-servers/haxe/server.js --targets node22-linuxstatic-armv7 --output bin/linux/haxe-language-server-armv7 | |
| - name: Zip artifacts (Linux) | |
| if: runner.os == 'Linux' | |
| run: | | |
| cd bin/linux | |
| zip haxe-language-server-linux-x64.zip haxe-language-server-x64 | |
| zip haxe-language-server-linux-arm64.zip haxe-language-server-arm64 | |
| zip haxe-language-server-linux-armv7.zip haxe-language-server-armv7 | |
| - name: Upload Linux x64 | |
| if: runner.os == 'Linux' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: haxe-language-server-linux-x64 | |
| path: bin/linux/haxe-language-server-linux-x64.zip | |
| - name: Upload Linux arm64 | |
| if: runner.os == 'Linux' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: haxe-language-server-linux-arm64 | |
| path: bin/linux/haxe-language-server-linux-arm64.zip | |
| - name: Upload Linux armv7 | |
| if: runner.os == 'Linux' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: haxe-language-server-linux-armv7 | |
| path: bin/linux/haxe-language-server-linux-armv7.zip | |
| # ── macOS ────────────────────────────────────────────────────────────── | |
| - name: Build binaries (macOS) | |
| if: runner.os == 'macOS' | |
| run: | | |
| mkdir -p bin/mac | |
| pkg language-servers/haxe/server.js --targets node22-macos-x64 --output bin/mac/haxe-language-server-x64 | |
| pkg language-servers/haxe/server.js --targets node22-macos-arm64 --output bin/mac/haxe-language-server-arm64 | |
| - name: Zip artifacts (macOS) | |
| if: runner.os == 'macOS' | |
| run: | | |
| cd bin/mac | |
| zip haxe-language-server-mac-x64.zip haxe-language-server-x64 | |
| zip haxe-language-server-mac-arm64.zip haxe-language-server-arm64 | |
| - name: Upload macOS x64 | |
| if: runner.os == 'macOS' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: haxe-language-server-mac-x64 | |
| path: bin/mac/haxe-language-server-mac-x64.zip | |
| - name: Upload macOS arm64 | |
| if: runner.os == 'macOS' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: haxe-language-server-mac-arm64 | |
| path: bin/mac/haxe-language-server-mac-arm64.zip | |
| # ── Collect & commit ──────────────────────────────────────────────────────── | |
| commit: | |
| name: Collect and commit binaries | |
| runs-on: ubuntu-latest | |
| needs: build | |
| # Only push on real commits to the default branch, not on PRs | |
| if: github.event_name != 'pull_request' | |
| steps: | |
| - name: Checkout repository with submodules | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| # Use a token with write access so the push is accepted | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| # Download every artifact produced by the matrix | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts/ | |
| # Unzip each archive into the correct bin/ sub-folder | |
| - name: Unzip Windows artifacts | |
| run: | | |
| mkdir -p bin/win | |
| unzip -o artifacts/haxe-language-server-win-x64/haxe-language-server-win-x64.zip -d bin/win/ | |
| unzip -o artifacts/haxe-language-server-win-arm64/haxe-language-server-win-arm64.zip -d bin/win/ | |
| - name: Unzip Linux artifacts | |
| run: | | |
| mkdir -p bin/linux | |
| unzip -o artifacts/haxe-language-server-linux-x64/haxe-language-server-linux-x64.zip -d bin/linux/ | |
| unzip -o artifacts/haxe-language-server-linux-arm64/haxe-language-server-linux-arm64.zip -d bin/linux/ | |
| unzip -o artifacts/haxe-language-server-linux-armv7/haxe-language-server-linux-armv7.zip -d bin/linux/ | |
| - name: Unzip macOS artifacts | |
| run: | | |
| mkdir -p bin/mac | |
| unzip -o artifacts/haxe-language-server-mac-x64/haxe-language-server-mac-x64.zip -d bin/mac/ | |
| unzip -o artifacts/haxe-language-server-mac-arm64/haxe-language-server-mac-arm64.zip -d bin/mac/ | |
| # Make Linux/macOS binaries executable after unzipping | |
| - name: Restore executable permissions | |
| run: | | |
| chmod +x bin/linux/haxe-language-server-x64 \ | |
| bin/linux/haxe-language-server-arm64 \ | |
| bin/linux/haxe-language-server-armv7 \ | |
| bin/mac/haxe-language-server-x64 \ | |
| bin/mac/haxe-language-server-arm64 | |
| - name: Commit and push binaries | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add bin/ | |
| # Only commit if there is something new | |
| git diff --cached --quiet && echo "No changes to commit." || \ | |
| git commit -m "ci: update pre-built language server binaries [skip ci]" | |
| git push |