Simple github action that helps to execute encryption and decryption of json files using the ejson cli. Current ejson version 1.5.2.
- name: ejson action
uses: Drafteame/ejson-action@main
with:
action: decrypt # [encrypt, decrypt]
file_path: <path-to-ejson-file>
private_key: <private-key-string> # needed if encrypt is used as action
out_file: <path-to-json-file> # File where the decrypted content will be stored (optional)
ejson_version: "1.5.2" # Specify the ejson version (optional). Defaults to 'latest' if left empty.
Output | Description |
---|---|
decrypted | Decrypted content of the file when the action is performed with the decrypt action |
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Decrypt file
uses: Drafteame/ejson-action@main
id: decrypt
with:
action: decrypt
file_path: <path-to-ejson-file>
private_key: <private-key-string>
out_file: <path-to-json-file>
ejson_version: "latest"
- name: Decrypted content
run: |
echo "Decrypted:"
echo '${{ steps.decrypt.outputs.decrypted }}'
echo
echo
echo "Stored File:"
cat <path-to-json-file>
echo
- name: Encrypt file
uses: Drafteame/ejson-action@main
id: encrypt
with:
action: encrypt
file_path: <path-to-ejson-file>
ejson_version: "latest"
- name: Encrypted content
run: |
echo "Encrypted content:"
cat <path-to-ejson-file>