Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions .github/workflows/javascript.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,7 @@ jobs:
- name: Build
working-directory: javascript
shell: bash
run: |
npx napi build --platform --release --target ${{ matrix.settings.target }}
mv index.js binding.js
mv index.d.ts binding.d.ts
npx tsc
run: npm run build:ci -- --target ${{ matrix.settings.target }} && npm run build:ts
- name: Ad-hoc sign binary (macOS)
if: runner.os == 'macOS'
working-directory: javascript
Expand Down
43 changes: 39 additions & 4 deletions .github/workflows/packaging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ on:
required: true
type: boolean
default: false

concurrency:
group: ${{ github.repository }}-${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true
Expand Down Expand Up @@ -1190,13 +1189,18 @@ jobs:
cache: 'npm'
cache-dependency-path: adbc/javascript/package-lock.json

- name: Setup Rust
run: |
rustup toolchain install stable --no-self-update
rustup default stable

- name: Install Node dependencies
working-directory: adbc/javascript
run: npm ci

- name: Build Node.js JS
- name: Build Node.js
working-directory: adbc/javascript
run: npm run build:ts
run: npm run build:ci && npm run build:ts

- name: Download Node.js binaries
uses: actions/download-artifact@v8
Expand Down Expand Up @@ -1226,6 +1230,37 @@ jobs:
path: |
adbc/javascript/*.tgz

upload-npm:
name: "Upload Node.js packages to npm"
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' && (github.event.schedule || inputs.upload_artifacts)
needs:
- node-dist
environment: npm
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
persist-credentials: false

- name: Download Node.js packages
uses: actions/download-artifact@v8
with:
name: node-packages
path: packages

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 24
registry-url: 'https://registry.npmjs.org'

- name: Publish to npm
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
Comment thread
kentkwu marked this conversation as resolved.
Outdated
NPM_TAG: next
run: ci/scripts/node_npm_upload.sh packages

release:
name: "Create release"
runs-on: ubuntu-latest
Expand Down Expand Up @@ -1272,7 +1307,7 @@ jobs:
-exec mv '{}' upload-staging \;

# Handle Node.js packages (in tarball form)
find ./release-artifacts/ -name 'adbc-driver-manager-*.tgz' -exec mv '{}' upload-staging \;
find ./release-artifacts/ -name 'apache-arrow-adbc-driver-manager-*.tgz' -exec mv '{}' upload-staging \;

UPLOAD=$(find upload-staging -type f | sort | uniq)

Expand Down
62 changes: 62 additions & 0 deletions ci/scripts/node_npm_upload.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

# Publish Node.js packages to an npm registry.
#
# Usage: ./ci/scripts/node_npm_upload.sh <packages_dir>
#
# Environment variables:
# NPM_TOKEN npm authentication token (required)
# NPM_REGISTRY registry URL (default: https://registry.npmjs.org)
# NPM_TAG dist-tag to publish under (default: latest)
# DRY_RUN set to 1 to pass --dry-run to npm publish

set -euo pipefail

main() {
local packages_dir
packages_dir="$(realpath "$1")"
local registry="${NPM_REGISTRY:-https://registry.npmjs.org}"
local dry_run_flag=""
if [[ "${DRY_RUN:-0}" == "1" ]]; then
dry_run_flag="--dry-run"
fi
local tag_flag=""
if [[ -n "${NPM_TAG:-}" ]]; then
tag_flag="--tag ${NPM_TAG}"
fi

# Write a temp .npmrc with the auth token for the target registry
local npmrc
npmrc=$(mktemp)
trap "rm -f ${npmrc}" EXIT
echo "//${registry#*://}/:_authToken=${NPM_TOKEN:-}" > "${npmrc}"
export NPM_CONFIG_USERCONFIG="${npmrc}"

# Publish platform-specific packages first, then the main package
for pkg in "${packages_dir}"/apache-arrow-adbc-driver-manager-*-*.tgz; do
echo "==== Publishing ${pkg}"
npm publish "${pkg}" --access public --registry "${registry}" ${tag_flag} ${dry_run_flag}
done

echo "==== Publishing main package"
npm publish "${packages_dir}"/apache-arrow-adbc-driver-manager-[0-9]*.tgz \
--access public --registry "${registry}" ${tag_flag} ${dry_run_flag}
}

main "$@"
3 changes: 3 additions & 0 deletions dev/release/02-sign.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ main() {
header "Upload signatures for Python"
upload_asset_signatures "${tag}" $(find "${download_dir}" -type f \( -name '*.whl' -or -name 'adbc_*.tar.gz' \))

header "Upload signatures for Node.js"
upload_asset_signatures "${tag}" $(find "${download_dir}" -type f -name 'apache-arrow-adbc-driver-manager-*.tgz')

header "Upload signatures for docs"
upload_asset_signatures "${tag}" "${download_dir}/docs.tgz"

Expand Down
57 changes: 57 additions & 0 deletions dev/release/post-09-npm.sh
Comment thread
kentkwu marked this conversation as resolved.
Comment thread
kentkwu marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/usr/bin/env bash
# -*- indent-tabs-mode: nil; sh-indentation: 2; sh-basic-offset: 2 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#

set -e
set -u
set -o pipefail

SOURCE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "${SOURCE_DIR}/utils-common.sh"
source "${SOURCE_DIR}/utils-prepare.sh"

main() {
if [ "$#" -ne 0 ]; then
echo "Usage: $0"
exit
fi

local -r tag="apache-arrow-adbc-${RELEASE}"
local -r tmp=$(mktemp -d -t "arrow-post-npm.XXXXX")

header "Downloading Node.js packages for ${RELEASE}"

gh release download \
--repo "${REPOSITORY}" \
"${tag}" \
--dir "${tmp}" \
--pattern "apache-arrow-adbc-driver-manager-*.tgz"

header "Uploading Node.js packages for ${RELEASE}"

DRY_RUN="${DRY_RUN:-0}" "${SOURCE_TOP_DIR}/ci/scripts/node_npm_upload.sh" "${tmp}"

rm -rf "${tmp}"

echo "Success! The released npm package is available here:"
echo " https://www.npmjs.com/package/@apache-arrow/adbc-driver-manager"
}

main "$@"
14 changes: 14 additions & 0 deletions dev/release/utils-prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ update_versions() {

local conda_version="${VERSION_NATIVE}"
local csharp_version="${VERSION_CSHARP}"
local js_version="${VERSION_JS}"
local linux_version="${RELEASE}"
local rust_version="${VERSION_CSHARP}"
case ${type} in
Expand Down Expand Up @@ -67,6 +68,7 @@ update_versions() {
echo "GLib/Ruby: ${glib_version}"
echo "Java: ${java_version}"
echo "Linux: ${linux_version}"
echo "JavaScript: ${js_version}"
echo "Python: ${py_version}"
echo "R: ${r_version}"
echo "Rust: ${rust_version}"
Expand Down Expand Up @@ -153,6 +155,18 @@ update_versions() {
cargo check --manifest-path "${ADBC_DIR}/rust/Cargo.toml"
git add "${ADBC_DIR}/rust/Cargo.lock"

pushd "${ADBC_DIR}/javascript"
sed -i.bak -E \
-e "s/^ \"version\": \".+\"/ \"version\": \"${js_version}\"/" \
-e "s/(\"@apache-arrow\/adbc-driver-manager[^\"]*\"): \".+\"/\1: \"${js_version}\"/g" \
package.json
rm package.json.bak
npx --yes napi version
sed -i.bak -E "s/^version = \".+\"/version = \"${js_version}\"/" Cargo.toml
rm Cargo.toml.bak
git add package.json package-lock.json Cargo.toml npm/*/package.json
popd

if [ ${type} = "release" ]; then
pushd "${ADBC_DIR}/ci/linux-packages"
rake version:update VERSION=${linux_version}
Expand Down
1 change: 1 addition & 0 deletions dev/release/versions.env
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ VERSION_JAVA="0.23.0"
VERSION_NATIVE="1.11.0"
VERSION_R="0.23.0"
VERSION_RUST="0.23.0"
VERSION_JS="0.23.0"

# Required by the version bump script
PREVIOUS_VERSION_NATIVE="1.10.0"
Expand Down
20 changes: 20 additions & 0 deletions docs/source/development/releasing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ How to Verify Release Candidates
- the javadoc command must also be accessible
- Go
- CMake, ninja-build, libpq (with headers), SQLite (with headers)
- Node.js 22+

Alternatively, you can have the verification script download and install dependencies automatically via Conda.
See the environment variables below.
Expand Down Expand Up @@ -411,6 +412,25 @@ Be sure to go through on the following checklist:
# dev/release/post-08-rust.sh
dev/release/post-08-rust.sh

.. dropdown:: Upload Node.js packages to npm
:class-title: sd-fs-5
:class-container: sd-shadow-md

You must have publish access to the `apache-arrow npm organization
<https://www.npmjs.com/org/apache-arrow>`_. If you don't have access
yet, an existing org admin can add you.

You will need to `create an access token <https://docs.npmjs.com/creating-and-viewing-access-tokens>`_.

An owner can upload:

.. code-block:: bash

export NPM_TOKEN=<your access token here>

# dev/release/post-09-npm.sh
dev/release/post-09-npm.sh

.. dropdown:: Update conda-forge packages
:class-title: sd-fs-5
:class-container: sd-shadow-md
Expand Down
4 changes: 4 additions & 0 deletions javascript/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,8 @@
Cargo.lock
dist
*.node
*.tgz
*.tsbuildinfo
binding.js
index.js
index.d.ts
4 changes: 2 additions & 2 deletions javascript/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

[package]
edition = "2021"
name = "adbc_driver_manager"
version = "0.1.0"
name = "adbc_driver_manager_node"
version = "0.23.0"
license = "Apache-2.0"

[lib]
Expand Down
Loading
Loading