-
Notifications
You must be signed in to change notification settings - Fork 38
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
Spruce release workflows #131
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: 'Release: @spruceDev build' | ||
|
||
on: | ||
workflow_dispatch: {} | ||
schedule: | ||
- cron: '0 0 * * *' | ||
|
||
jobs: | ||
version-and-release: | ||
name: Release dev build to NPM | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: spruce | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Build the |
||
|
||
- name: Setup | ||
uses: ./.github/actions/setup | ||
|
||
- name: Get recent changes | ||
id: list-commits | ||
run: | | ||
recentCommits=$(git log --since=yesterday --oneline) | ||
echo "commits=$recentCommits" >> "$GITHUB_OUTPUT" | ||
|
||
- name: Abort if no recent changes | ||
if: steps.list-commits.outputs.commits == '' | ||
uses: andymckay/cancel-action@0.3 | ||
|
||
- name: 'Bump version, do not commit' | ||
shell: bash | ||
run: | | ||
currentVersion=$(jq -r '.version' package.json) | ||
timestamp=$(date +%Y%m%d%H%M%S) | ||
devVersion="$currentVersion-spruceDev.$timestamp" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. devVersion string changed to reflect |
||
jq --arg newVersion "$devVersion" '.version = $newVersion' package.json > package.tmp && mv package.tmp package.json | ||
jq --arg newVersion "$devVersion" '.version = $newVersion' package-lock.json > package-lock.tmp && mv package-lock.tmp package-lock.json | ||
jq --arg newVersion "$devVersion" '.packages[""].version = $newVersion' package-lock.json > package-lock.tmp && mv package-lock.tmp package-lock.json | ||
jq --null-input --arg version "$devVersion" '{"name": "@pinecone-database/pinecone", "version": $version}' > src/version.json | ||
|
||
- name: 'Publish to npm' | ||
run: npm publish --tag spruceDev | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Publish with |
||
shell: bash | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: 'Release: @spruce build' | ||
|
||
on: | ||
workflow_dispatch: {} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Only run when manually triggered. Since there are no automatic builds of this job, we can remove the steps that checked whether there are any recent changes (designed to prevent cluttering up npm with a lot of identical builds). |
||
|
||
jobs: | ||
version-and-release: | ||
name: Release dev build to NPM | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: spruce | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Build |
||
|
||
- name: Setup | ||
uses: ./.github/actions/setup | ||
|
||
- name: 'Bump version, do not commit' | ||
shell: bash | ||
run: | | ||
currentVersion=$(jq -r '.version' package.json) | ||
timestamp=$(date +%Y%m%d%H%M%S) | ||
devVersion="$currentVersion-spruce.$timestamp" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. devVersion string updated to have |
||
jq --arg newVersion "$devVersion" '.version = $newVersion' package.json > package.tmp && mv package.tmp package.json | ||
jq --arg newVersion "$devVersion" '.version = $newVersion' package-lock.json > package-lock.tmp && mv package-lock.tmp package-lock.json | ||
jq --arg newVersion "$devVersion" '.packages[""].version = $newVersion' package-lock.json > package-lock.tmp && mv package-lock.tmp package-lock.json | ||
jq --null-input --arg version "$devVersion" '{"name": "@pinecone-database/pinecone", "version": $version}' > src/version.json | ||
|
||
- name: 'Publish to npm' | ||
run: npm publish --tag spruce | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Release with |
||
shell: bash | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
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.
Run every night, or when manually triggered