-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[BLD] JS client release to GH packages + dev releases #2173
Merged
tazarov
merged 3 commits into
main
from
trayan-05-09-feat_js_client_release_to_gh_packages
Jun 11, 2024
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
name: 📦 Development Release JavaScript client | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
release-dev: | ||
strategy: | ||
matrix: | ||
registry: [ "https://npm.pkg.github.com" ] | ||
runs-on: ubuntu-latest | ||
if: ${{ github.ref == 'refs/heads/main' }} | ||
permissions: write-all | ||
steps: | ||
- name: Check if tag matches the pattern | ||
id: check-tag | ||
run: | | ||
# we don't necessarily need this | ||
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then | ||
echo "Push to main branch, releasing dev version to GH packages" | ||
echo "NPM_SCRIPT=release_dev" >> "$GITHUB_ENV" | ||
else | ||
echo "The ref does not point to main, exiting workflow" # we alredy make the check above but this is a good practice | ||
exit 1 | ||
fi | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: "16.x" | ||
registry-url: ${{ matrix.registry }} | ||
- name: Install dependencies | ||
run: npm install | ||
working-directory: ./clients/js/ | ||
- name: Dev Version | ||
id: dev-version | ||
run: | | ||
set -e | ||
# Get current version | ||
CURRENT_VERSION=$(node -p "require('./package.json').version") | ||
# Generate a beta tag using commit short sha and run id | ||
COMMIT_SHA=$(git rev-parse --short HEAD) | ||
DEV_TAG="dev.${COMMIT_SHA}-${GITHUB_RUN_ID}" | ||
# Create full version with beta tag | ||
BASE_VERSION=$(echo $CURRENT_VERSION | cut -f1,2 -d.) | ||
PATCH_VERSION=$(echo $CURRENT_VERSION | cut -f3 -d.) | ||
# bump patch version | ||
NEW_PATCH_VERSION=$((PATCH_VERSION + 1)) | ||
NEW_VERSION="${BASE_VERSION}.${NEW_PATCH_VERSION}-${DEV_TAG}" | ||
echo "NEW_VERSION=${NEW_VERSION}" >> "$GITHUB_ENV" | ||
- name: Test & publish | ||
run: npm run db:run && PORT=8001 npm run $NPM_SCRIPT | ||
working-directory: ./clients/js/ | ||
env: | ||
NODE_AUTH_TOKEN: ${{ matrix.registry == 'https://registry.npmjs.org' && secrets.NPM_TOKEN || secrets.GITHUB_TOKEN }} |
tazarov marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains 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
This file contains 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we put this in .github/workflows/release-chromadb.yml instead, then we don't need to manually compute the tag name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The JS client is a separate release/version from the Python release. Reusing the same tag would be challenging. However, I've made it a point to include comprehensive information in the dev release. This will allow us to pinpoint which commit and GH job built the package for bug traceability. We could potentially implement the same for the Python client.