Skip to content

Commit

Permalink
add release builder
Browse files Browse the repository at this point in the history
  • Loading branch information
khancyr committed Jun 4, 2024
1 parent 8ed21e3 commit 8a8de45
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 1 deletion.
66 changes: 66 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# This workflow will build deb binary

name: Build deb binary

on:
release:
types: [published]

workflow_dispatch:

jobs:
get-ref-name:
runs-on: ubuntu-latest
outputs:
ref_name: ${{ steps.get-ref-name.outputs.ref_name }}
steps:
- name: Get ref_name
id: get-ref-name
run: |
if [ "${{ github.event_name }}" == "pull_request" ]; then
sanitized_ref=$(echo ${{ github.head_ref }} | sed 's/[^a-zA-Z0-9.]/-/g')
else
sanitized_ref=$(echo ${{ github.ref_name }} | sed 's/[^a-zA-Z0-9.]/-/g')
fi
echo "ref_name=$sanitized_ref"
echo "ref_name=$sanitized_ref" >> $GITHUB_OUTPUT || exit 1
build:
needs: get-ref-name
name: Build deb
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
path: src/microxrceddsgen
submodules: recursive

- uses: ./src/microxrceddsgen/.github/actions/install-apt-packages

- name: Get minimum supported version of CMake
uses: lukka/get-cmake@latest
with:
cmakeVersion: 3.16.3
- name: Use cmake
run: cmake --version

- name: Build microxrceddsgen
run: |
cd src/microxrceddsgen
./gradlew assemble
- name: Test microxrceddsgen
run: |
cd src/microxrceddsgen
./gradlew test -Dbranch=v2.3.0
- name : Build deb
run: |
cd src/microxrceddsgen
rm -rf .github
./build-ap-microxrceddsgen-deb.sh ${{ needs.get-ref-name.outputs.ref_name }}
- name: "Publish to GitHub"
uses: softprops/action-gh-release@v2
with:
files: src/microxrceddsgen/ap_microxrceddsgen_*.deb
11 changes: 10 additions & 1 deletion build-ap-microxrceddsgen-deb.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
#!/bin/sh
VERSION="0.0.1"

if [ -z "$1" ]; then
echo "Usage: $0 <version>"
exit 1
fi

VERSION="$1"

echo "Updating control file with version $VERSION"
sed -i "s/^Version: .*/Version: $VERSION/" ap-microxrceddsgen/DEBIAN/control

echo "Copying launcher"
cp scripts/microxrceddsgen ap-microxrceddsgen/opt/ardupilot/Micro-XRCE-DDS-Gen/bin/microxrceddsgen
Expand Down

0 comments on commit 8a8de45

Please sign in to comment.