Skip to content

Update identifiable logic #5501

Update identifiable logic

Update identifiable logic #5501

Workflow file for this run

name: Build PR
on:
pull_request:
merge_group:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v3
- name: Create git branch
run: |
# Create a git branch from the detached HEAD.
# We need this for some integration tests.
# This branch is not pushed, it's just local to the workflow environment.
git checkout -b test-branch-${{ github.sha }}
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Setup node
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'pnpm'
- name: Set build version
run: echo "TAG=0.0.0-${{ github.ref_name == 'changeset-release/main' && 'beta' || 'alpha' }}.v$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
id: version
- name: Check secrets exist
run: echo "exist=${{ secrets.GITHUB_TOKEN != '' && 'true' || 'false' }}" >> $GITHUB_OUTPUT
id: secrets
- name: Find Comment
uses: peter-evans/find-comment@v1
if: ${{ github.repository == 'xataio/client-ts' && github.event_name == 'pull_request' }}
id: find-comment-1
with:
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: Your pull request has been published to npm
- name: Update existing comment with stale state of npm release
uses: peter-evans/create-or-update-comment@v1
id: update-existing
if: ${{ github.repository == 'xataio/client-ts' && github.event_name == 'pull_request' && steps.find-comment-1.outputs.comment-id != '' }}
with:
token: ${{ secrets.GITHUB_TOKEN }}
comment-id: ${{ steps.find-comment-1.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
edit-mode: replace
body: |
Your pull request has been published to npm.
You can install @xata.io/client by running:
```
npm install @xata.io/client@${{ steps.version.outputs.TAG }}
```
Other packages are published like this:
```
npm install @xata.io/mypackage@${{ steps.version.outputs.TAG }}
```
To test the CLI, run:
```
npx @xata.io/cli@${{ steps.version.outputs.TAG }}
```
[Pull request has been updated, please wait for latest changes to be pushed to npm...]
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Compile
run: pnpm build
- name: Configure npm registry token
if: ${{ steps.secrets.outputs.exist == 'true' }}
run: echo //registry.npmjs.org/:_authToken=${NPM_TOKEN} > .npmrc
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Exit pre-mode if set
continue-on-error: true
run: npx changeset pre exit
- name: Publish build
if: ${{ steps.secrets.outputs.exist == 'true' && github.event_name == 'pull_request' }}
env:
GITHUB_TOKEN: ${{ secrets.GIT_TOKEN }}
run: |
cat << EOF > .changeset/force-canary-build.md
---
'@xata.io/plugin-client-opentelemetry': patch
'@xata.io/drizzle': patch
'@xata.io/kysely': patch
'@xata.io/pgroll': patch
'@xata.io/importer': patch
'@xata.io/codegen': patch
'@xata.io/client': patch
'@xata.io/cli': patch
---
Force canary build
EOF
npx changeset version --snapshot ${{ github.ref_name == 'changeset-release/main' && 'beta' || 'alpha' }}
npx changeset publish --tag ${{ github.ref_name == 'changeset-release/main' && 'dev' || 'canary' }} --no-git-tag
- name: Find Comment
uses: peter-evans/find-comment@v1
if: ${{ steps.secrets.outputs.exist == 'true' && github.event_name == 'pull_request' }}
id: find-comment-2
with:
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: Your pull request has been published to npm
- name: Create or update comment of npm release
uses: peter-evans/create-or-update-comment@v1
if: ${{ steps.secrets.outputs.exist == 'true' && github.event_name == 'pull_request' }}
with:
token: ${{ secrets.GITHUB_TOKEN }}
comment-id: ${{ steps.find-comment-2.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
edit-mode: replace
body: |
Your pull request has been published to npm.
You can install @xata.io/client by running:
```
npm install @xata.io/client@${{ steps.version.outputs.TAG }}
```
Other packages are published like this:
```
npm install @xata.io/mypackage@${{ steps.version.outputs.TAG }}
```
To test the CLI, run:
```
npx @xata.io/cli@${{ steps.version.outputs.TAG }}
```
- name: Canary build E2E test
if: ${{ steps.secrets.outputs.exist == 'true' && github.event_name == 'pull_request' }}
run: pnpm run test:canary
env:
XATA_API_KEY: ${{ secrets.INTEGRATION_TEST_API_KEY }}
XATA_WORKSPACE: ${{ secrets.INTEGRATION_TEST_WORKSPACE }}
CANARY_VERSION: ${{ steps.version.outputs.TAG }}
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Create git branch
run: |
# Create a git branch from the detached HEAD.
# We need this for some integration tests.
# This branch is not pushed, it's just local to the workflow environment.
git checkout -b test-branch-${{ github.sha }}
- name: Read .nvmrc
run: echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_OUTPUT
id: nvm
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Use Node.js ${{ steps.nvm.outputs.NVMRC }}
uses: actions/setup-node@v3
with:
node-version: ${{ steps.nvm.outputs.NVMRC }}
cache: 'pnpm'
- name: Check secrets exist
run: echo "exist=${{ secrets.GITHUB_TOKEN != '' && 'true' || 'false' }}" >> $GITHUB_OUTPUT
id: secrets
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Compile
run: pnpm build
- name: Lint
run: pnpm lint
- name: Test
if: ${{ steps.secrets.outputs.exist == 'true' }}
run: |
pnpm test
env:
XATA_API_KEY: ${{ secrets.INTEGRATION_TEST_API_KEY }}
XATA_WORKSPACE: ${{ secrets.INTEGRATION_TEST_WORKSPACE }}