Skip to content

Commit

Permalink
fix(parse-package-toml): use a different method to invoke yq which al…
Browse files Browse the repository at this point in the history
…lows to use any folder (#39)
  • Loading branch information
LouisBrunner authored Dec 20, 2023
1 parent c5e6242 commit a331555
Showing 1 changed file with 21 additions and 23 deletions.
44 changes: 21 additions & 23 deletions .github/actions/parse-package-toml/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,38 +10,36 @@ inputs:
outputs:
name:
description: "The name extracted from the aica-package.toml"
value: ${{ steps.output.outputs.name }}
value: ${{ steps.metadata.outputs.name }}
version:
description: "The version extracted from the aica-package.toml"
value: ${{ steps.output.outputs.version }}
value: ${{ steps.metadata.outputs.version }}
ros_name:
description: "The ROS name extracted from the aica-package.toml"
value: ${{ steps.output.outputs.ros_name }}
value: ${{ steps.metadata.outputs.ros_name }}

runs:
using: composite
steps:
- name: Get name from aica-package.toml
id: name
uses: mikefarah/yq@master
with:
cmd: yq '.metadata.name' ${{ inputs.directory }}/aica-package.toml
- name: Get ROS name from aica-package.toml
id: ros_name
uses: mikefarah/yq@master
with:
cmd: yq '.metadata.ros-name' ${{ inputs.directory }}/aica-package.toml
- name: Get version from aica-package.toml
id: version
uses: mikefarah/yq@master
with:
cmd: yq '.metadata.version' ${{ inputs.directory }}/aica-package.toml
- name: Prepare output
id: output
- name: Install yq
run: |
NAME="${{ steps.name.outputs.result }}"
VERSION="${{ steps.version.outputs.result }}"
ROS_NAME="${{ steps.ros_name.outputs.result }}"
if [ -x "$(command -v yq)" ]; then
echo "yq already installed"
exit 0
fi
VERSION=v4.40.5
BINARY=yq_linux_amd64
wget https://github.com/mikefarah/yq/releases/download/${VERSION}/${BINARY}.tar.gz -O - |\
tar xz && mv ${BINARY} /usr/bin/yq
shell: bash
- name: Get metadata from aica-package.toml
id: metadata
run: |
INPUT="${{ inputs.directory }}/aica-package.toml"
NAME=$(yq '.metadata.name' $INPUT)
ROS_NAME=$(yq '.metadata.ros-name' $INPUT)
VERSION=$(yq '.metadata.version' $INPUT)
echo "Name: $NAME"
echo "Version: $VERSION"
echo "ROS Name: $ROS_NAME"
Expand Down

0 comments on commit a331555

Please sign in to comment.