mirror of
https://github.com/ditkrg/build-image-workflow.git
synced 2026-01-22 23:27:06 +00:00
Add JSON output and extraction using jq
Signed-off-by: Shakar Bakr <5h4k4r.b4kr@gmail.com>
This commit is contained in:
parent
c14b1df2c6
commit
80887ec86b
20
action.yml
20
action.yml
@ -43,6 +43,26 @@ runs:
|
|||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Run a command and output JSON
|
||||||
|
id: run-command
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
echo '{"tags": ["tag1", "tag2", "tag3"]}' > output.json
|
||||||
|
|
||||||
|
- name: Display JSON
|
||||||
|
run: cat output.json
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
- name: Extract specific value from JSON using jq
|
||||||
|
id: extract-json
|
||||||
|
run: echo "::set-output name=tag::$(echo '${{ steps.run-command.outputs.json }}' | jq -r '.tags[0]')"
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
- name: Display Extracted Value
|
||||||
|
run: |
|
||||||
|
echo "Extracted Tag: ${{ steps.extract-json.outputs.tag }}"
|
||||||
|
shell: bash
|
||||||
|
|
||||||
- id: meta
|
- id: meta
|
||||||
name: Extract Metadata
|
name: Extract Metadata
|
||||||
uses: docker/metadata-action@v5
|
uses: docker/metadata-action@v5
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user