ci: move px4_msgs sync from jenkins to github actions (#26061)

* ci: move px4_msgs sync from jenkins to github actions

I noticed it has not synced in a while, the last time was here:
49a0f6c52c

The difference to before is that now also the release branches will be
synced instead of only 'main'.

---------

Co-authored-by: Beniamino Pozzan <beniamino.pozzan@gmail.com>
This commit is contained in:
Beat Küng
2025-12-09 19:16:18 +01:00
committed by GitHub
parent 73a8fc8fb0
commit 703d66e605
2 changed files with 62 additions and 30 deletions

62
.github/workflows/sync_to_px4_msgs.yml vendored Normal file
View File

@@ -0,0 +1,62 @@
name: Sync ROS 2 messages to px4_msgs
on:
push:
branches:
- 'main'
- 'stable'
- 'beta'
- 'release/**'
paths:
- 'msg/**'
- 'srv/**'
workflow_dispatch:
permissions:
contents: read
jobs:
sync_to_px4_msgs:
if: github.repository == 'PX4/PX4-Autopilot'
runs-on: [runs-on,runner=4cpu-linux-x64,image=ubuntu22-full-x64,"run-id=${{ github.run_id }}",spot=false]
steps:
- name: Checkout PX4 repo
uses: actions/checkout@v4
- name: Setup git credentials
run: |
git config --global user.name "${{ secrets.PX4BUILDBOT_USER }}"
git config --global user.email "${{ secrets.PX4BUILDBOT_EMAIL }}"
- name: Clone PX4_msgs repo
run: |
git clone https://${{ secrets.PX4BUILTBOT_PERSONAL_ACCESS_TOKEN }}@github.com/PX4/px4_msgs.git
- name: Check out the same branch as the PX4 repo
run: |
cd px4_msgs
if git checkout ${{ github.ref_name }}; then
echo "Checked out existing branch"
else
git checkout -b ${{ github.ref_name }}
fi
- name: Copy ROS 2 messages
run: |
rm -f px4_msgs/msg/*.msg
rm -f px4_msgs/msg/versioned/*.msg
rm -f px4_msgs/srv/*.srv
rm -f px4_msgs/srv/versioned/*.srv
cp msg/*.msg px4_msgs/msg/
cp msg/versioned/*.msg px4_msgs/msg/ || true
cp srv/*.srv px4_msgs/srv/
cp srv/versioned/*.srv px4_msgs/srv/ || true
- name: Commit and push changes
run: |
cd px4_msgs
git status
git add .
git commit -a -m "Update to PX4 ${{ github.sha }}" || true
git push origin ${{ github.ref_name }} || true
cd ..
rm -rf px4_msgs

30
Jenkinsfile vendored
View File

@@ -220,36 +220,6 @@ pipeline {
}
}
stage('PX4 ROS msgs') {
agent {
docker { image 'px4io/px4-dev-base-focal:2021-08-18' }
}
steps {
sh('export')
sh('make distclean; git clean -ff -x -d .')
withCredentials([usernamePassword(credentialsId: 'px4buildbot_github_personal_token', passwordVariable: 'GIT_PASS', usernameVariable: 'GIT_USER')]) {
sh("git clone https://${GIT_USER}:${GIT_PASS}@github.com/PX4/px4_msgs.git")
// 'main' branch
sh('rm -f px4_msgs/msg/*.msg')
sh('rm -f px4_msgs/msg/versioned/*.msg')
sh('rm -f px4_msgs/srv/*.srv')
sh('rm -f px4_msgs/srv/versioned/*.srv')
sh('cp msg/*.msg px4_msgs/msg/')
sh('cp msg/versioned/*.msg px4_msgs/msg/ || true')
sh('cp srv/*.srv px4_msgs/srv/')
sh('cp srv/versioned/*.srv px4_msgs/srv/ || true')
sh('cd px4_msgs; git status; git add .; git commit -a -m "Update message definitions `date`" || true')
sh('cd px4_msgs; git push origin main || true')
sh('rm -rf px4_msgs')
}
}
when {
anyOf {
branch 'main'
}
}
}
stage('S3') {
agent {
docker { image 'px4io/px4-dev-base-focal:2021-08-18' }