mirror of
https://github.com/ditkrg/build-image-workflow.git
synced 2026-01-22 21:27:05 +00:00
Refactor JSON extraction in action.yml
Signed-off-by: Shakar Bakr <5h4k4r.b4kr@gmail.com>
This commit is contained in:
parent
80887ec86b
commit
00bb7fe36f
26
action.yml
26
action.yml
@ -47,21 +47,7 @@ runs:
|
||||
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
|
||||
echo ${{ fromJson(steps.meta.outputs.json) }}
|
||||
|
||||
- id: meta
|
||||
name: Extract Metadata
|
||||
@ -82,16 +68,6 @@ runs:
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
type=semver,pattern={{version}},priority=9999 #1
|
||||
|
||||
- name: echo
|
||||
run: |
|
||||
echo $(echo '${{ steps.meta.outputs.json }}' | jq -r '.tags[0]') > meta.json
|
||||
shell: bash
|
||||
|
||||
- name: dsad
|
||||
run: |
|
||||
cat meta.json
|
||||
shell: bash
|
||||
|
||||
- name: Login to Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user