Skip to content

feat: 🎸 add script to auto update package.json on publish #320

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 1 commit into from
Jan 27, 2025
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
2 changes: 2 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ jobs:
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Set package version
run: ./scripts/set-package-version.sh
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "polymesh-rest-api",
"version": "7.0.0",
"version": "0.0.0",
"description": "Provides a REST like interface for interacting with the Polymesh blockchain",
"author": "Polymesh Association",
"private": true,
Expand Down
13 changes: 13 additions & 0 deletions scripts/set-package-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

# Get the latest tag
TAG_NAME=$(git describe --tags --abbrev=0)

# Strip the 'v' prefix if it exists
VERSION=${TAG_NAME#v}


# Update the version field in package.json
jq --arg version "$VERSION" '.version = $version' package.json > tmp.json && mv tmp.json package.json

echo "Updated package.json version to $VERSION"
Loading