Release TypeScript SDK fix-release-ts-flow #2
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 TypeScript | |
| run-name: "Release TypeScript SDK ${{ github.ref_name }}" | |
| on: | |
| push: | |
| tags: | |
| - "typescript/v*" | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| id-token: write | |
| jobs: | |
| build: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| settings: | |
| - host: linux-ubuntu-latest | |
| target: x86_64-unknown-linux-gnu | |
| - host: linux-ubuntu-latest | |
| target: aarch64-unknown-linux-gnu | |
| - host: windows-server-latest | |
| target: x86_64-pc-windows-msvc | |
| name: Build - ${{ matrix.settings.target }} | |
| runs-on: | |
| group: databricks-protected-runner-group | |
| labels: ${{ matrix.settings.host }} | |
| defaults: | |
| run: | |
| working-directory: typescript | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: Install Rust (Unix) | |
| if: runner.os != 'Windows' | |
| run: | | |
| curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable | |
| echo "$HOME/.cargo/bin" >> $GITHUB_PATH | |
| - name: Install Rust (Windows) | |
| if: runner.os == 'Windows' | |
| run: | | |
| Invoke-WebRequest -Uri https://win.rustup.rs/x86_64 -OutFile rustup-init.exe | |
| .\rustup-init.exe -y --default-toolchain stable | |
| echo "$env:USERPROFILE\.cargo\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | |
| shell: powershell | |
| - name: Add Rust target | |
| run: rustup target add ${{ matrix.settings.target }} | |
| - name: Install cross-compilation tools (Linux ARM64) | |
| if: matrix.settings.target == 'aarch64-unknown-linux-gnu' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build | |
| run: npm run build -- --target ${{ matrix.settings.target }} | |
| env: | |
| CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: bindings-${{ matrix.settings.target }} | |
| path: 'typescript/*.node' | |
| if-no-files-found: error | |
| publish: | |
| name: Publish to npm | |
| runs-on: | |
| group: databricks-protected-runner-group | |
| labels: linux-ubuntu-latest | |
| needs: build | |
| defaults: | |
| run: | |
| working-directory: typescript | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: typescript/artifacts | |
| - name: List downloaded artifacts | |
| run: ls -R artifacts/ | |
| - name: Copy bindings | |
| run: | | |
| cp artifacts/bindings-x86_64-unknown-linux-gnu/*.node . | |
| cp artifacts/bindings-aarch64-unknown-linux-gnu/*.node . | |
| cp artifacts/bindings-x86_64-pc-windows-msvc/*.node . | |
| - name: Publish | |
| run: npm publish --access public --provenance --ignore-scripts | |
| release: | |
| name: Create GitHub Release | |
| runs-on: | |
| group: databricks-protected-runner-group | |
| labels: linux-ubuntu-latest | |
| needs: publish | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Extract version from tag | |
| id: version | |
| run: echo "version=${GITHUB_REF#refs/tags/typescript/v}" >> "$GITHUB_OUTPUT" | |
| - name: Extract release notes from changelog | |
| run: | | |
| version="v${{ steps.version.outputs.version }}" | |
| awk "/^## Release ${version}/{found=1; next} /^## /{if(found) exit} found{print}" typescript/CHANGELOG.md > /tmp/release-notes.md | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| name: TypeScript SDK v${{ steps.version.outputs.version }} | |
| body_path: /tmp/release-notes.md |