-
Notifications
You must be signed in to change notification settings - Fork 0
34 lines (28 loc) · 1.12 KB
/
read_version.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
name: TEST YAML Data
on:
workflow_dispatch:
jobs:
extract-yaml:
runs-on: ubuntu-latest
env:
VERSION: 1.0.0
steps:
- name: Checkout code
uses: actions/checkout@v3
# https://github.com/mikefarah/yq?tab=readme-ov-file#github-action
- name: Install yq
uses: mikefarah/yq@master
- name: Read YAML and set environment variables
id: yaml_to_env
run: |
# Extract data for version ${{ env.VERSION }} from versions.yml
version_data=$(yq '.versions[] | select(.version == "${{ env.VERSION }}")' versions.yml)
# Extract specific fields and store them in environment variables
echo "version=$(echo "$version_data" | yq '.version')" >> $GITHUB_ENV
echo "label=$(echo "$version_data" | yq '.label')" >> $GITHUB_ENV
echo "description=$(echo "$version_data" | yq '.description')" >> $GITHUB_ENV
- name: Echo extracted variables
run: |
echo "Version: ${{ env.version }}"
echo "Label: ${{ env.label }}"
echo "Description: ${{ env.description }}"