Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: example CI modification to publish napi flight sql client packages #31

Merged
merged 1 commit into from
Dec 4, 2024
Merged
Changes from all 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
64 changes: 63 additions & 1 deletion .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -212,4 +212,66 @@ jobs:
shell: bash
- name: Test bindings
working-directory: ${{ env.FLIGHT_SQL_PATH }}
run: pnpm test
run: pnpm test
publish:
name: Publish flight-sql-client
runs-on: ubuntu-latest
needs:
- test-linux-x64-gnu-binding
- test-macOS-binding
steps:
- uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install pnpm
id: pnpm-install
uses: pnpm/action-setup@v3
with:
version: 9.8.0
run_install: false
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}_publish-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}_publish-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
- name: Install dependencies
run: pnpm install --frozen-lockfile
working-directory: ${{ env.FLIGHT_SQL_PATH }}
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: ${{ env.FLIGHT_SQL_PATH }}/artifacts
- name: Move artifacts
run: pnpm artifacts
working-directory: ${{ env.FLIGHT_SQL_PATH }}
- name: List packages
run: ls -R ./npm
shell: bash
working-directory: ${{ env.FLIGHT_SQL_PATH }}
- name: Publish
working-directory: ${{ env.FLIGHT_SQL_PATH }}
run: |
npm config set provenance true
if git log -1 --pretty=%B | grep "^[0-9]\+\.[0-9]\+\.[0-9]\+$";
then
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
npm publish --access public
elif git log -1 --pretty=%B | grep "^[0-9]\+\.[0-9]\+\.[0-9]\+";
then
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
npm publish --tag next --access public
else
echo "Not a release, skipping publish"
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}