Skip to content

Commit aed8c43

Browse files
committed
workflow fixes
1 parent 694cc2d commit aed8c43

File tree

3 files changed

+107
-6
lines changed

3 files changed

+107
-6
lines changed

.github/workflows/publish.yml

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
name: Publish Packages to npm
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*' # Run on any tag that starts with v (e.g., v1.0.0)
7+
8+
jobs:
9+
publish:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v4
14+
15+
- name: Setup Node.js
16+
uses: actions/setup-node@v4
17+
with:
18+
node-version: '18'
19+
registry-url: 'https://registry.npmjs.org/'
20+
scope: '@queryleaf'
21+
22+
- name: Get tag version
23+
id: get_version
24+
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
25+
26+
- name: Install dependencies
27+
run: yarn install --frozen-lockfile
28+
29+
- name: Run tests
30+
run: yarn test
31+
32+
- name: Build packages
33+
run: yarn build
34+
35+
# Update versions in package.json files before publishing
36+
- name: Update lib package version
37+
run: |
38+
cd packages/lib
39+
yarn version --new-version $VERSION --no-git-tag-version
40+
41+
- name: Update cli package version
42+
run: |
43+
cd packages/cli
44+
yarn version --new-version $VERSION --no-git-tag-version
45+
sed -i 's/"@queryleaf\/lib": ".*"/"@queryleaf\/lib": "'"$VERSION"'"/g' package.json
46+
47+
- name: Update server package version
48+
run: |
49+
cd packages/server
50+
yarn version --new-version $VERSION --no-git-tag-version
51+
sed -i 's/"@queryleaf\/lib": ".*"/"@queryleaf\/lib": "'"$VERSION"'"/g' package.json
52+
53+
- name: Update postgres-server package version
54+
run: |
55+
cd packages/postgres-server
56+
yarn version --new-version $VERSION --no-git-tag-version
57+
sed -i 's/"@queryleaf\/lib": ".*"/"@queryleaf\/lib": "'"$VERSION"'"/g' package.json
58+
59+
# Publish packages in the correct order
60+
- name: Publish lib package
61+
run: |
62+
cd packages/lib
63+
yarn publish --access public
64+
env:
65+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
66+
67+
# Publish the other packages in parallel since they all depend on lib
68+
- name: Publish remaining packages
69+
run: |
70+
cd packages/cli
71+
yarn publish --access public &
72+
73+
cd ../server
74+
yarn publish --access public &
75+
76+
cd ../postgres-server
77+
yarn publish --access public &
78+
79+
wait
80+
env:
81+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
82+
83+
# Create GitHub release for this version
84+
- name: Create GitHub Release
85+
uses: softprops/action-gh-release@v1
86+
with:
87+
name: Release ${{ env.VERSION }}
88+
body: |
89+
# QueryLeaf v${{ env.VERSION }}
90+
91+
Published packages:
92+
- @queryleaf/lib@${{ env.VERSION }}
93+
- @queryleaf/cli@${{ env.VERSION }}
94+
- @queryleaf/server@${{ env.VERSION }}
95+
- @queryleaf/postgres-server@${{ env.VERSION }}
96+
env:
97+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/test.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,22 +30,22 @@ jobs:
3030
uses: actions/setup-node@v3
3131
with:
3232
node-version: ${{ matrix.node-version }}
33-
cache: 'npm'
33+
cache: 'yarn'
3434

3535
- name: Install dependencies
36-
run: npm ci
36+
run: yarn install --frozen-lockfile
3737

3838
- name: Run unit tests
39-
run: npm run test:unit
39+
run: yarn test:unit
4040

4141
- name: Run integration tests
42-
run: npm run test:integration
42+
run: yarn test:integration
4343
env:
4444
# This ensures testcontainers can find Docker
4545
TESTCONTAINERS_HOST_OVERRIDE: "localhost"
4646

4747
- name: TypeCheck
48-
run: npm run typecheck
48+
run: yarn typecheck
4949

5050
- name: Build package
51-
run: npm run build
51+
run: yarn build

CLAUDE.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# QueryLeaf Development Guide
22

3+
QueryLeaf is a SQL to MongoDB compiler / translator.
4+
35
## Build & Test Commands
46
- Full build: `yarn build`
57
- Typecheck: `yarn typecheck`
@@ -12,6 +14,8 @@
1214
- Documentation: `yarn docs:serve` (dev), `yarn docs:build` (build)
1315

1416
## Code Style Guidelines
17+
- We use YARN, not NPM
18+
- GitHub actions is used for builds, see workflows in the .github folder.
1519
- TypeScript with strict typing; avoid `any` when possible
1620
- Single quotes, trailing commas, 2-space indentation, 100 char line limit
1721
- Prefix unused variables with underscore (e.g., `_unused`)

0 commit comments

Comments
 (0)