Skip to content

rm deprecated robot template #224

rm deprecated robot template

rm deprecated robot template #224

name: Build and Push (xbot2_docker-noble-ROS2)
on:
schedule:
- cron: '0 0 1 * *' # Run on the first day of every month at midnight
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
branches:
- master
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Get commit message
run: |
COMMIT_MSG="$(git log -1 --pretty=%B)"
{
echo 'COMMIT_MESSAGE<<EOF'
echo "$COMMIT_MSG"
echo 'EOF'
} >> "$GITHUB_ENV"
- name: Log in to Docker Hub
run: |
echo "${{ secrets.DOCKERHUB_TOKEN }}" | docker login -u "${{ secrets.DOCKERHUB_USERNAME }}" --password-stdin
- name: Create netrc file for private repo access
run: |
echo "machine github.com login ${{ secrets.GH_ORG_USERNAME }} password ${{ secrets.GH_ORG_TOKEN }}" > ~/.netrc
chmod 600 ~/.netrc
- name: Run build.bash
run: |
SNAPSHOT_NAME="noble-ros2-linuxv5-$(date +%Y%m%d%H%M%S)"
echo "SNAPSHOT_NAME=$SNAPSHOT_NAME" >> "$GITHUB_ENV"
export BUILDX_BAKE_ENTITLEMENTS_FS=0
./noble/build.bash \
--user-id 1000 \
--recipes-repo https://github.com/advrhumanoids/multidof_recipes.git \
--recipes-tag ros2 \
--kernel-ver 5 \
--forest-njobs 4 \
--netrc ~/.netrc \
--no-cache \
--snapshot \
--snapshot-name "$SNAPSHOT_NAME"
if: github.event_name == 'schedule' || startsWith(github.ref, 'refs/tags/v') || contains(env.COMMIT_MESSAGE, '[build noble]')
- name: Run push.sh
run: ./noble/push.bash --tag "$SNAPSHOT_NAME"
if: github.event_name == 'schedule' || startsWith(github.ref, 'refs/tags/v')
- name: Archive snapshot
run: tar -czf snapshot-${{ env.SNAPSHOT_NAME }}.tar.gz -C noble/snapshots ${{ env.SNAPSHOT_NAME }}
if: github.event_name == 'schedule' || startsWith(github.ref, 'refs/tags/v') || contains(env.COMMIT_MESSAGE, '[build noble]')
- name: Find previous snapshot URL
id: prev_snapshot
run: |
URL=$(gh api "repos/${{ github.repository }}/releases" \
--jq 'map(select(.tag_name | startswith("noble-ros2-linuxv5-"))) | first | .assets[] | select(.name | startswith("snapshot-")) | .browser_download_url' \
2>/dev/null || true)
echo "url=${URL}" >> "$GITHUB_OUTPUT"
env:
GH_TOKEN: ${{ github.token }}
if: github.event_name == 'schedule' || startsWith(github.ref, 'refs/tags/v') || contains(env.COMMIT_MESSAGE, '[build noble]')
- name: Compute release diff
run: |
PREV="${{ steps.prev_snapshot.outputs.url }}"
if [[ -n "$PREV" ]]; then
python noble/compute_release_diff.py "$PREV" "snapshot-${{ env.SNAPSHOT_NAME }}.tar.gz" > release-notes.txt || true
else
echo "First snapshot – no previous release to diff against." > release-notes.txt
fi
if: github.event_name == 'schedule' || startsWith(github.ref, 'refs/tags/v') || contains(env.COMMIT_MESSAGE, '[build noble]')
- name: Upload snapshot to GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ env.SNAPSHOT_NAME }}
name: ${{ env.SNAPSHOT_NAME }}
files: snapshot-${{ env.SNAPSHOT_NAME }}.tar.gz
body_path: release-notes.txt
if: github.event_name == 'schedule' || startsWith(github.ref, 'refs/tags/v')
- name: Commit snapshot to snapshots branch
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
if git fetch origin snapshots:snapshots 2>/dev/null; then
git checkout snapshots
else
git checkout --orphan snapshots
git rm -rf . --quiet
git checkout HEAD -- .gitignore 2>/dev/null || true
fi
cp -r noble/snapshots/${{ env.SNAPSHOT_NAME }} ${{ env.SNAPSHOT_NAME }}
git add ${{ env.SNAPSHOT_NAME }}
git commit -m "snapshot ${{ env.SNAPSHOT_NAME }}"
git push origin snapshots
if: github.event_name == 'schedule' || startsWith(github.ref, 'refs/tags/v')