|
| 1 | +name: Publish Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - "v*" |
| 7 | + workflow_dispatch: |
| 8 | + |
| 9 | +permissions: |
| 10 | + contents: write |
| 11 | + |
| 12 | +jobs: |
| 13 | + build-and-release: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + |
| 16 | + env: |
| 17 | + CMAKE_BUILD_TYPE: Release |
| 18 | + |
| 19 | + steps: |
| 20 | + - name: Checkout repository |
| 21 | + uses: actions/checkout@v4 |
| 22 | + |
| 23 | + - name: Install dependencies |
| 24 | + run: sudo apt-get update && sudo apt-get install -y libzmq3-dev libopencv-dev |
| 25 | + |
| 26 | + - name: Setup ROS environment |
| 27 | + uses: ros-tooling/[email protected] |
| 28 | + with: |
| 29 | + required-ros-distributions: noetic |
| 30 | + |
| 31 | + - name: Configure |
| 32 | + run: cmake -B build -DCMAKE_BUILD_TYPE=${{ env.CMAKE_BUILD_TYPE }} |
| 33 | + |
| 34 | + - name: Build |
| 35 | + run: cmake --build build --config ${{ env.CMAKE_BUILD_TYPE }} |
| 36 | + |
| 37 | + - name: Collect binaries and libraries |
| 38 | + shell: bash |
| 39 | + run: | |
| 40 | + set -eo pipefail |
| 41 | + mkdir -p dist/bin dist/lib |
| 42 | +
|
| 43 | + if compgen -G "build/**/libinfinite_sense_core.*" > /dev/null; then |
| 44 | + find build -maxdepth 3 -name 'libinfinite_sense_core.*' -exec cp {} dist/lib/ \; |
| 45 | + fi |
| 46 | +
|
| 47 | + while IFS= read -r exe; do |
| 48 | + if file "$exe" | grep -q 'ELF'; then |
| 49 | + install -Dm755 "$exe" "dist/bin/$(basename "$exe")" |
| 50 | + fi |
| 51 | + done < <(find build -maxdepth 3 \( -path '*/example/*' -o -path '*/tools/*' \) -type f -executable) |
| 52 | +
|
| 53 | + tar -czf "SimpleSensorSync-${{ github.ref_name }}-linux-x64.tar.gz" -C dist . |
| 54 | +
|
| 55 | + - name: Upload build artifact |
| 56 | + uses: actions/upload-artifact@v4 |
| 57 | + with: |
| 58 | + name: SimpleSensorSync-${{ github.ref_name }}-linux-x64 |
| 59 | + path: SimpleSensorSync-${{ github.ref_name }}-linux-x64.tar.gz |
| 60 | + |
| 61 | + - name: Create GitHub release |
| 62 | + if: startsWith(github.ref, 'refs/tags/') |
| 63 | + uses: softprops/action-gh-release@v1 |
| 64 | + with: |
| 65 | + files: SimpleSensorSync-${{ github.ref_name }}-linux-x64.tar.gz |
| 66 | + env: |
| 67 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments