Refactor JSON extraction in action.yml

Signed-off-by: Shakar Bakr <5h4k4r.b4kr@gmail.com>
This commit is contained in:
Shakar Bakr 2024-03-03 14:08:35 +03:00
parent 80887ec86b
commit 00bb7fe36f
No known key found for this signature in database
GPG Key ID: DA55A26823AE3C28

View File

@ -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: