Update JSON file Value(s) for Publishing.
Zero configuration action to update a manifest.json
file version
value to a release tag.
Allows setting multiple key/value pairs and setting nested keys. Currently only supports string values.
Note
Please submit a Feature Request for new features or Open an Issue if you find any bugs.
input | required | default | description |
---|---|---|---|
file | No | manifest.json |
JSON File Path |
keys | No | version |
JSON Keys to Update, One per Line |
values | No | $GITHUB_REF_NAME |
Values to Update, One per Line |
write | No | true |
Write Updates to file |
seperator | No | . |
Nested Key Seperator |
If no options are passed, it will update the manifest.json
file's key version
to the value of GITHUB_REF_NAME
.
For multiple keys
and values
use new lines with a yaml |
.
- name: 'Update JSON'
uses: cssnr/update-json-value-action@v1
output | description |
---|---|
result | Updated JSON String |
- name: 'Update JSON'
id: json
uses: cssnr/update-json-value-action@v1
- name: 'Echo Result'
run: echo '${{ steps.json.outputs.result }}'
Same as above but manually setting values and only running on release
events.
- name: 'Update JSON'
uses: cssnr/update-json-value-action@v1
if: ${{ github.event_name == 'release' }}
with:
file: manifest.json
keys: version
values: ${{ github.ref_name }}
Same as above but also setting an additional key value pair.
- name: 'Update JSON'
uses: cssnr/update-json-value-action@v1
if: ${{ github.event_name == 'release' }}
with:
file: manifest.json
keys: |
version
version_name
values: |
${{ github.ref_name }}
"Release ${{ github.ref_name }}"
Set a nested key and use file from different directory.
- name: 'Update JSON'
uses: cssnr/update-json-value-action@v1
if: ${{ github.event_name == 'release' }}
with:
file: src/manifest.json
keys: |
meta.version
values: |
"Release ${{ github.ref_name }}"
For general help or to request a feature, see:
- Q&A Discussion: https://github.com/cssnr/update-json-value-action/discussions/categories/q-a
- Request a Feature: https://github.com/cssnr/update-json-value-action/discussions/categories/feature-requests
If you are experiencing an issue/bug or getting unexpected results, you can:
- Report an Issue: https://github.com/cssnr/update-json-value-action/issues
- Chat with us on Discord: https://discord.gg/wXy6m2X8wY
- Provide General Feedback: https://cssnr.github.io/feedback/
Currently, the best way to contribute to this project is to star this project on GitHub.
Additionally, you can support other GitHub Actions I have published:
- VirusTotal Action
- Update Version Tags Action
- Update JSON Value Action
- Parse Issue Form Action
- Mirror Repository Action
- Portainer Stack Deploy
- Mozilla Addon Update Action
For a full list of current projects to support visit: https://cssnr.github.io/