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

Add set-version script and modified publish workflow #14

Merged
merged 1 commit into from
Jan 21, 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
4 changes: 4 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ jobs:
packages: write
contents: read
steps:
- name: Get tag name
uses: olegtarasov/[email protected]
id: tagName
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
Expand All @@ -22,6 +25,7 @@ jobs:
version: 9
- run: pnpm install
- run: pnpm build
- run: /bin/bash set-version.sh ${{ steps.tagName.outputs.tag }}
- run: pnpm publish --no-git-checks --access public
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@kubetail/ui",
"version": "0.1.4",
"version": "0.0.1",
"type": "module",
"sideEffects": false,
"module": "./dist/index.js",
Expand Down
26 changes: 26 additions & 0 deletions set-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash

# Check if a version number was provided as an argument
if [ "$#" -ne 1 ]; then
echo "Usage: $0 <new-version>"
exit 1
fi

# Assign the new version number from command line arguments
NEW_VERSION=$1

# Path to the local package.json file
PACKAGE_JSON="./package.json"

# Check if the local package.json file exists
if [ ! -f "$PACKAGE_JSON" ]; then
echo "Error: No package.json file found in the current directory."
exit 1
fi

# Update the version in the local package.json file
echo "Updating version in $PACKAGE_JSON to $NEW_VERSION"
# Portable handling of in-place editing with sed
sed -i.bak -E "s/\"version\": \".*\"/\"version\": \"$NEW_VERSION\"/" "$PACKAGE_JSON" && rm "$PACKAGE_JSON.bak"

echo "Version update completed."