Skip to content

Merge pull request #23 from sid410/dev/0.1.6 #21

Merge pull request #23 from sid410/dev/0.1.6

Merge pull request #23 from sid410/dev/0.1.6 #21

Workflow file for this run

name: Build and Deploy for Release and Documentation
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Required Packages
run: |
sudo apt-get update
sudo apt-get install -y cmake doxygen graphviz curl libcurl4-openssl-dev
# We need to add these manually to make the opencv action below work
- name: Add Missing APT Keys
run: |
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 40976EAF437D05B5
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3B4FE6ACC0B21F32
sudo apt-get update
- name: Setup opencv
uses: Dovyski/[email protected]
with:
opencv-version: '4.9.0'
opencv-extra-modules: false
install-deps: false
- name: Configure the Project for Release
run: |
cmake -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_EXPORT_COMPILE_COMMANDS=TRUE \
-DCMAKE_C_COMPILER=/usr/bin/gcc \
-DCMAKE_CXX_COMPILER=/usr/bin/g++ \
-S ${{ github.workspace }} \
-B ${{ github.workspace }}/build \
-G "Unix Makefiles"
- name: Build the Project
run: |
cmake --build ${{ github.workspace }}/build --config Release --target all -j 2
- name: Generate Documentation
run: doxygen Doxyfile
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
if: github.event_name == 'push'
with:
personal_token: ${{ secrets.DOCUMENTATION_PAT }}
external_repository: imb410/TrafficEZ-Documentation
publish_branch: gh-pages
publish_dir: ./doc/html
allow_empty_commit: true
keep_files: false
- name: Find Built Executable
id: find_executable
run: |
EXECUTABLE_PATH=$(find ${{ github.workspace }}/build/src -type f -name 'TrafficEZ-*' | head -n 1)
if [[ -z "$EXECUTABLE_PATH" ]]; then
echo "Executable not found!"
exit 1
fi
EXECUTABLE_NAME=$(basename $EXECUTABLE_PATH)
TAG_NAME="v${EXECUTABLE_NAME#TrafficEZ-}"
echo "EXECUTABLE_PATH=$EXECUTABLE_PATH" >> $GITHUB_ENV
echo "TAG_NAME=$TAG_NAME" >> $GITHUB_ENV
echo "RELEASE_NAME=$EXECUTABLE_NAME" >> $GITHUB_ENV
- name: Create Versioned Release
id: create_versioned_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
with:
tag_name: ${{ env.TAG_NAME }}
release_name: ${{ env.RELEASE_NAME }}
draft: false
prerelease: false
- name: Upload Release Asset to Versioned Release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
with:
upload_url: ${{ steps.create_versioned_release.outputs.upload_url }}
asset_path: ${{ env.EXECUTABLE_PATH }}
asset_name: TrafficEZ
asset_content_type: application/octet-stream