Skip to content

Commit

Permalink
[Docker][other]: Support github action
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason-xy committed Jan 25, 2024
1 parent e2ea0cf commit e614c0a
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 23 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/manual_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ jobs:
run: git submodule update --init --recursive

- name: Build Bootloader
run: echo y | docker_build.sh ${{ inputs.branch_name }} ${{ inputs.target_name }}
run: docker_build.sh ${{ inputs.branch_name }} ${{ inputs.target_name }} y
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: hkust_nxt_bootloader
path: PX4-Autopilot/build/${{ inputs.target_name }}_bootloader/${{ inputs.target_name }}_bootloader.elf

- name: Build PX4-Autopilot
run: echo y | docker_build.sh ${{ inputs.branch_name }} ${{ inputs.target_name }}_bootloader
run: docker_build.sh ${{ inputs.branch_name }} ${{ inputs.target_name }}_bootloader y
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/px4-autopilot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ jobs:
run: git submodule update --init --recursive

- name: Build Bootloader
run: echo y | docker_build.sh develop_v1.14.x hkust_nxt-v1
run: docker_build.sh develop_v1.14.x hkust_nxt-v1 y
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: hkust_nxt_bootloader
path: PX4-Autopilot/build/hkust_nxt-v1_bootloader/hkust_nxt-v1_bootloader.elf

- name: Build PX4-Autopilot
run: echo y | docker_build.sh develop_v1.14.x hkust_nxt-v1_bootloader
run: docker_build.sh develop_v1.14.x hkust_nxt-v1_bootloader y
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
Expand Down
40 changes: 21 additions & 19 deletions docker_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,24 @@ switch_branch(){
fi

# Switch branch
echo "Warning: this will remove all changes including untracked files"
read -p "Confirm?(Y/N)" ans

if [[ "$ans" == [Yy] ]]; then
echo "Confirmed"
git checkout -f $1
git clean -xdf -f
git submodule update --recursive
git submodule foreach --recursive git fetch --all
git submodule foreach --recursive git reset --hard
git submodule foreach --recursive git clean -fdx -f

echo "Successfully switched to branch $1"
else
echo "Canceled"
exit 1
if [[ "$2" != [Yy] ]]; then
echo "Warning: this will remove all changes including untracked files"
read -p "Confirm?(Y/N)" ans

if [[ "$ans" == [Yy] ]]; then
echo "Confirmed"
git checkout -f $1
git clean -xdf -f
git submodule update --recursive
git submodule foreach --recursive git fetch --all
git submodule foreach --recursive git reset --hard
git submodule foreach --recursive git clean -fdx -f

echo "Successfully switched to branch $1"
else
echo "Canceled"
exit 1
fi
fi
}

Expand Down Expand Up @@ -113,7 +115,7 @@ check_docker(){
}

main(){
switch_branch $1
switch_branch $1 $3
set_param $1
check_docker
docker_exist=$(docker ps -a|grep ${DOCEKR_NAME})
Expand All @@ -128,9 +130,9 @@ main(){
build_frameware $2
}

if [ $# -ne 2 ]
if [ $# -ne 2 ] && [ $# -ne 3 ]
then
help
else
main $1 $2
main $1 $2 $3
fi

0 comments on commit e614c0a

Please sign in to comment.