Generate the `.urdf` files in CI and upload them to the release page. The ROS 2 installation was referred to the following documentation. https://docs.ros.org/en/kilted/Installation/Ubuntu-Install-Debs.html We've modified it to run on push and pull_request for easier checking.
107 lines
3.3 KiB
YAML
107 lines
3.3 KiB
YAML
# Copyright 2025 Enactic, Inc.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
name: Release
|
|
on:
|
|
- push
|
|
- pull_request
|
|
jobs:
|
|
build:
|
|
name: Build
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
id:
|
|
- "rolling"
|
|
- "kilted"
|
|
- "jazzy"
|
|
- "humble"
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
- name: Build URDF files
|
|
run: |
|
|
docker container run \
|
|
--rm \
|
|
--volume ${PWD}:/source \
|
|
osrf/ros:${{ matrix.id }}-desktop-full \
|
|
bash -c '
|
|
cd /source
|
|
colcon build
|
|
source install/setup.bash
|
|
for file in $(find urdf -name "*.xacro"); do
|
|
xacro "${file}" bimanual:=true > "${file%.*}_${{ matrix.id }}_bimanual.urdf"
|
|
xacro "${file}" bimanual:=false > "${file%.*}_${{ matrix.id }}.urdf"
|
|
done'
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: urdf-${{ matrix.id }}
|
|
path: urdf/**/*.urdf
|
|
publish:
|
|
name: Publish
|
|
needs: build
|
|
runs-on: ubuntu-latest
|
|
environment: release
|
|
permissions:
|
|
contents: write
|
|
discussions: write
|
|
steps:
|
|
- name: Set environments
|
|
run: |
|
|
if [ "${GITHUB_REF_TYPE}" = "tag" ]; then
|
|
echo "VERSION=${GITHUB_REF_NAME}" >> ${GITHUB_ENV}
|
|
else
|
|
echo "VERSION=x.y.z" >> ${GITHUB_ENV}
|
|
fi
|
|
if [ "${GITHUB_EVENT_NAME}" = "pull_request" ]; then
|
|
echo "REF=${GITHUB_SHA}" >> ${GITHUB_ENV}
|
|
else
|
|
echo "REF=${GITHUB_REF_NAME}" >> ${GITHUB_ENV}
|
|
fi
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/download-artifact@v5
|
|
with:
|
|
pattern: urdf-*
|
|
path: artifacts
|
|
merge-multiple: true
|
|
- name: Create source archive
|
|
run: |
|
|
name="openarm-description-${VERSION}"
|
|
git archive --format=tar ${REF} \
|
|
--prefix "${name}/" \
|
|
--output "${name}.tar"
|
|
|
|
mkdir "${name}"
|
|
mv artifacts "${name}/urdf"
|
|
find "${name}/urdf" -type f | tar -rf "${name}.tar" -T -
|
|
gzip "${name}.tar"
|
|
|
|
sha256sum "${name}.tar.gz" > "${name}.tar.gz.sha256"
|
|
sha512sum "${name}.tar.gz" > "${name}.tar.gz.sha512"
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: source-archive
|
|
path: openarm-description-*.tar.gz*
|
|
- name: Create GitHub Release
|
|
if: github.ref_type == 'tag'
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
run: |
|
|
gh release create ${GITHUB_REF_NAME} \
|
|
--discussion-category Announcements \
|
|
--generate-notes \
|
|
--repo ${GITHUB_REPOSITORY} \
|
|
--title "OpenArm Description ${VERSION}" \
|
|
--verify-tag \
|
|
openarm-description-${VERSION}.tar.gz*
|