Skip to content

Merge branch 'main' of https://github.com/GovCraft/paseto_cli #1

Merge branch 'main' of https://github.com/GovCraft/paseto_cli

Merge branch 'main' of https://github.com/GovCraft/paseto_cli #1

name: Update Package Version
on:
workflow_call:
inputs:
version:
required: true
type: string
secrets:
token:
required: true
env:
CARGO_TERM_COLOR: always
jobs:
update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.token }}
- name: Update package.json version
run: |
package_json=$(cat package.json)
# Update the version and optional dependencies
new_version="${{ inputs.version }}"
updated_package_json=$(echo "$package_json" | jq --arg new_version "$new_version" '.version = $new_version | .optionalDependencies."paseto_cli-linux-x64" = $new_version | .optionalDependencies."paseto_cli-darwin-x64" = $new_version | .optionalDependencies."paseto_cli-darwin-aarch64" = $new_version | .optionalDependencies."paseto_cli-windows-x64" = $new_version | .scripts.postinstall = "BINARY_DISTRIBUTION_VERSION=\($new_version) node ./install.js"')
# Save the updated package.json content
echo "$updated_package_json" > package.json
# Check if changes were made and commit them
if ! git diff --quiet; then
echo "Version updated to $new_version and optional dependencies updated" >> $GITHUB_STEP_SUMMARY
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git commit -a -m "chore: workflow update package.json version to $new_version"

Check failure on line 38 in .github/workflows/update_package_json_version.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/update_package_json_version.yml

Invalid workflow file

You have an error in your yaml syntax on line 38
git push
else
echo "Package.json version is already $new_version, no update needed" >> $GITHUB_STEP_SUMMARY
fi
shell: bash