Skip to content
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

Merged
merged 1 commit into from
Oct 3, 2023
Merged
Show file tree
Hide file tree
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
46 changes: 46 additions & 0 deletions .github/workflows/release-spruce-dev.yml
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 * * *'
Copy link
Collaborator Author

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


jobs:
version-and-release:
name: Release dev build to NPM
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: spruce
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Build the spruce branch


- 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"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

devVersion string changed to reflect spruceDev

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
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Publish with spruceDev tag.

shell: bash
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
34 changes: 34 additions & 0 deletions .github/workflows/release-spruce.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: 'Release: @spruce build'

on:
workflow_dispatch: {}
Copy link
Collaborator Author

@jhamon jhamon Oct 3, 2023

Choose a reason for hiding this comment

The 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
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Build spruce branch


- 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"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

devVersion string updated to have spruce identifier

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
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Release with spruce tag

shell: bash
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}