Skip to content

Commit

Permalink
Merge pull request #34 from brightsign/diegobrsign/docs
Browse files Browse the repository at this point in the history
Use npm version to bump version
  • Loading branch information
diegobrsign authored May 31, 2024
2 parents ff8bf04 + 0db2026 commit aec4ffa
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 15 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,6 @@ jobs:
- run: yarn --frozen-lockfile
- run: echo '//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}' > ${{ github.workspace }}/.npmrc
- run: ./scripts/bump_version.sh
env:
GH_REF_VERSION: ${{ github.ref_name }}
- run: yarn workspaces run publish
16 changes: 1 addition & 15 deletions scripts/bump_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,7 @@ for dir in $workspace_dirs; do
# add package registry configuration from setup-node at the root of the repo
cp ../.npmrc .npmrc

PACKAGE_NAME=$(jq -r '.name' package.json)

# Run the GitHub API command to get the latest package version
response=$(gh api orgs/brightsign/packages/npm/$PACKAGE_NAME/versions 2>/dev/null)
if echo "$response" | jq -e '.message' >/dev/null; then
# If there is an error message in the response, use the default version
version_name="1.0.0"
echo "Using default version 1.0.0 for $PACKAGE_NAME"
else
# Extract version name, if possible, otherwise use default
version_name=$(echo "$response" | jq -r '.[0].name // "1.0.0"')
fi

# Update the package.json with the latest version
jq --indent 4 ".version = \"$version_name\"" package.json > temp.json && mv temp.json package.json
npm version $GH_REF_VERSION

popd
done

0 comments on commit aec4ffa

Please sign in to comment.