8000 ci: adding publish script by bmschmidt · Pull Request #55 · nomic-ai/ts-nomic · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

ci: adding publish script #55

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

Merged
merged 5 commits into from
Jul 23, 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
44 changes: 44 additions & 0 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Publish Next Tag Version

on:
push:
branches:
- main

jobs:
publish-next-tag-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

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

- name: Install release-please
run: npm install -g release-please

- name: Determine next version and update package.json
run: |
# Determine next version
OUTPUT=$(release-please release-pr --dry-run --token=${{ secrets.GITHUB_TOKEN }} --repo-url=${{ github.repository }} --default-branch=main)
NEXT_VERSION=$(echo "$OUTPUT" | grep "chore(main): release atlas" | sed 's/.*atlas //')
echo "Next version: $NEXT_VERSION"

# Count existing pre-releases
NEXT_VERSION_COUNT=$(npm view . versions --json | jq "[.[] | select(startswith(\"$NEXT_VERSION-next.\"))] | length")
echo "Number of existing pre-releases: $NEXT_VERSION_COUNT"

# Create final version string
FINAL_VERSION="${NEXT_VERSION}-next.${NEXT_VERSION_COUNT}"
echo "Final version: $FINAL_VERSION"

# Update package.json
npm version $FINAL_VERSION --no-git-tag-version
npm publish --preid=next
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
0