deploy_workflow #1422
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: deploy_workflow | |
on: | |
schedule: | |
- cron: 0 0 * * * | |
workflow_dispatch: | |
push: | |
branches: | |
- "master" | |
paths: | |
- ./workflow_templates/** | |
- ./.github/workflows/deploy_workflow.yaml | |
jobs: | |
get_template: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: templates | |
path: ./workflow_templates/*.yaml | |
deploy_workflow: | |
needs: get_template | |
runs-on: ubuntu-22.04 | |
strategy: | |
max-parallel: 2 | |
fail-fast: false | |
matrix: | |
package_name: [ | |
boost_geometry_util, | |
color_names, | |
data_buffer, | |
detic_onnx_ros2, | |
geographic_conversion, | |
geographic_info, | |
grid_map_type_adapter, | |
hermite_path_planner, | |
hungarian_solver, | |
image_processing_utils, | |
joy_to_twist, | |
lidar_camera_fusion, | |
lua_vendor, | |
message_synchronizer, | |
navi_sim, | |
nmea_hardware_interface, | |
nmea_to_geopose, | |
odom_frame_publisher, | |
ouxt_common, | |
pcl_apps, | |
pcl_type_adapter, | |
perception_bringup, | |
perception_msgs, | |
perception_server, | |
playstation_controller_drivers, | |
point_painting, | |
prometheus_ros, | |
protolink, | |
quaternion_operation, | |
robotx_behavior_tree, | |
robotx_communication, | |
robotx_costmap_calculator, | |
robotx_ekf, | |
robotx_planner_bringup, | |
scan_segmentation, | |
sol_vendor, | |
tcp_sender, | |
usv_controller, | |
vision_opencv, | |
wamv_control, | |
wamv_description, | |
] | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: templates | |
path: ~/templates | |
- uses: actions/checkout@v4 | |
with: | |
repository: OUXT-Polaris/${{ matrix.package_name }} | |
token: ${{ secrets.WAMV_TAN_BOT_SECRET }} | |
- name: Deploy build test workflow | |
uses: OUXT-Polaris/setup-workflow-action@0.0.1 | |
with: | |
template: /home/runner/templates/BuildTest.yaml | |
project_path: ./ | |
parameters: "{}" | |
- name: Deploy release workflow | |
uses: OUXT-Polaris/setup-workflow-action@0.0.1 | |
with: | |
template: /home/runner/templates/Release.yaml | |
project_path: ./ | |
parameters: "{}" | |
- name: Deploy update workflow status workflow | |
uses: OUXT-Polaris/setup-workflow-action@0.0.1 | |
with: | |
template: /home/runner/templates/UpdateWorkflowStatus.yaml | |
project_path: ./ | |
parameters: "{}" | |
- name: Deploy code review workflow | |
uses: OUXT-Polaris/setup-workflow-action@0.0.1 | |
with: | |
template: /home/runner/templates/Review.yaml | |
project_path: ./ | |
parameters: "{}" | |
- name: Check branch exist | |
id: check_branch | |
run: | | |
echo "name=exist::$(git ls-remote --heads https://github.com/OUXT-Polaris/${{ matrix.package_name }}.git workflow/sync | wc -l)" >> "$GITHUB_OUTPUT" | |
- name: Count changes | |
id: changes | |
run: | | |
git add -N . | |
echo "name=count::$(git diff --name-only | wc -l)" >> "$GITHUB_OUTPUT" | |
- name: Check if branch exists | |
id: check_branch_exist | |
run: | | |
if git ls-remote --heads https://github.com/OUXT-Polaris/${{ matrix.package_name }}.git workflow/sync | grep -q 'refs/heads/workflow/sync'; then | |
echo "exist=true" >> "$GITHUB_OUTPUT" | |
else | |
echo "exist=false" >> "$GITHUB_OUTPUT" | |
fi | |
- name: Delete old branch | |
if: steps.check_branch_exist.outputs.exist == 'true' | |
run: | | |
git push origin --delete workflow/sync || true | |
- name: Print deleted branch | |
if: steps.check_branch_exist.outputs.exist == 'true' | |
run: | | |
echo "Deleted branch workflow/sync" | |
- uses: peter-evans/create-pull-request@v3 | |
id: create_pull_request | |
if: steps.changes.outputs.count > 0 | |
with: | |
token: ${{ secrets.WAMV_TAN_BOT_SECRET }} | |
commit-message: Setup workflow | |
committer: wam-v-tan <ouxt.share@gmail.com> | |
author: wam-v-tan <ouxt.share@gmail.com> | |
signoff: false | |
branch: workflow/sync | |
base: ${{ steps.check_default_branch.outputs.default_branch }} | |
delete-branch: true | |
title: '[Bot] Update workflow' | |
body: | | |
# Description | |
Setup Build test workflow | |
# How to check | |
Please check passing all CI test. | |
labels: | | |
bot | |
assignees: wam-v-tan | |
reviewers: wam-v-tan | |
team-reviewers: | | |
bot | |
draft: false |