From f3548c119a1d04ec19a90d83aba8c9c8a7ffcce3 Mon Sep 17 00:00:00 2001 From: JafarAbdi Date: Wed, 28 Feb 2024 10:51:03 +0000 Subject: [PATCH 1/2] Add PRE_BUILD_HOOK input to run commands before sbuild --- README.md | 4 ++++ action.yaml | 4 ++++ build | 6 ++++++ 3 files changed, 14 insertions(+) diff --git a/README.md b/README.md index 9cbc3c7..1584d98 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,10 @@ If set, this branch will be used to push the packages instead of `DEB_DISTRO-ROS If set to true, Git Large File Storage will be used to store the generated binaries. +## ``PRE_BUILD_HOOK`` + +TODO + ## Example usage ``` diff --git a/action.yaml b/action.yaml index e0ccf6c..7913a04 100644 --- a/action.yaml +++ b/action.yaml @@ -40,6 +40,9 @@ inputs: GIT_LFS: description: If set to true, use Git Large File Storage for storing binaries (*.deb and *.ddeb) required: false + PRE_BUILD_HOOK: + description: If set, this script will be executed before running sbuild. + required: false runs: using: composite steps: @@ -76,3 +79,4 @@ runs: SQUASH_HISTORY: ${{ inputs.SQUASH_HISTORY == 'true' && 'true' || '' }} PACKAGES_BRANCH: ${{ inputs.PACKAGES_BRANCH }} GIT_LFS: ${{ inputs.GIT_LFS == 'true' && 'true' || '' }} + PRE_BUILD_HOOK: ${{ inputs.PRE_BUILD_HOOK }} diff --git a/build b/build index 1148483..e9ac94d 100755 --- a/build +++ b/build @@ -81,6 +81,12 @@ echo "$ROSDEP_SOURCE" > "$APT_REPO/2-remote.list" ROS_HOME="$APT_REPO/ros" ROSDEP_SOURCE_PATH="$APT_REPO:/etc/ros/rosdep/sources.list.d/" rosdep update +echo "Run pre-build hook" + +if [ -n "$PRE_BUILD_HOOK" ]; then + eval "$PRE_BUILD_HOOK" +fi + echo "Run sbuild" # Don't build tests From 40035fb59e27a175ac99237031371e0ab26cfaf1 Mon Sep 17 00:00:00 2001 From: JafarAbdi Date: Wed, 28 Feb 2024 11:27:57 +0000 Subject: [PATCH 2/2] Fix bug --- action.yaml | 2 +- build | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/action.yaml b/action.yaml index 7913a04..99cd84f 100644 --- a/action.yaml +++ b/action.yaml @@ -69,6 +69,7 @@ runs: ROSDEP_SOURCE: ${{ inputs.ROSDEP_SOURCE }} SKIP_ROS_REPOSITORY: ${{ inputs.SKIP_ROS_REPOSITORY }} SKIP_PACKAGES: ${{ inputs.SKIP_PACKAGES }} + PRE_BUILD_HOOK: ${{ inputs.PRE_BUILD_HOOK }} - name: Create apt repository and deploy it run: $GITHUB_ACTION_PATH/repository shell: sh @@ -79,4 +80,3 @@ runs: SQUASH_HISTORY: ${{ inputs.SQUASH_HISTORY == 'true' && 'true' || '' }} PACKAGES_BRANCH: ${{ inputs.PACKAGES_BRANCH }} GIT_LFS: ${{ inputs.GIT_LFS == 'true' && 'true' || '' }} - PRE_BUILD_HOOK: ${{ inputs.PRE_BUILD_HOOK }} diff --git a/build b/build index e9ac94d..8bf6ef9 100755 --- a/build +++ b/build @@ -81,9 +81,9 @@ echo "$ROSDEP_SOURCE" > "$APT_REPO/2-remote.list" ROS_HOME="$APT_REPO/ros" ROSDEP_SOURCE_PATH="$APT_REPO:/etc/ros/rosdep/sources.list.d/" rosdep update -echo "Run pre-build hook" if [ -n "$PRE_BUILD_HOOK" ]; then + echo "Run pre-build hook" eval "$PRE_BUILD_HOOK" fi