From e903082b36824cd4a49171f79547971c57716247 Mon Sep 17 00:00:00 2001 From: Skydust Date: Wed, 25 Dec 2024 15:58:22 +0100 Subject: [PATCH] First commit --- .gitignore | 1 + action.yml | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 .gitignore create mode 100644 action.yml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..485dee6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.idea diff --git a/action.yml b/action.yml new file mode 100644 index 0000000..62b0a72 --- /dev/null +++ b/action.yml @@ -0,0 +1,33 @@ +name: Update node version +description: Updates the version inside the package json +author: Skydust + +# Define your inputs here. +inputs: + path: + description: The package folder + required: false + default: "." + version: + description: The version, not needed most of the time + required: false + default: "${{ env.NEW_VERSION }}" + +runs: + using: composite + steps: + - name: Update package.json + run: | + log_info "Updating package.json" + cd "${{ inputs.path }}" + + jq --color-output --arg NEW_VERSION "${{ inputs.version }}" '.version = $NEW_VERSION' package.json > package.json.tmp + mv package.json.tmp package.json + + if [[ "${{ inputs.version }}" == *-* ]]; then + NPM_TAG="sha" + else + NPM_TAG="" + fi + + echo NPM_TAG=${NPM_TAG} >> $GITEA_ENV