BMS Diagnostics Mode #3179
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: DBC Release | |
on: | |
pull_request: | |
branches: | |
- master | |
types: | |
- labeled | |
- unlabeled | |
- synchronize | |
jobs: | |
determine-should-run: | |
name: Check for want-DBC label | |
runs-on: ubuntu-22.04 | |
outputs: | |
should_run: ${{ steps.should_run.outputs.should_run }} | |
steps: | |
- name: Determine Should Run | |
id: should_run | |
run: | | |
echo "${{ toJSON(github.event.pull_request.labels.*.name) }}" | |
echo "should_run=${{ contains(github.event.pull_request.labels.*.name, 'want_DBC') }}" >> $GITHUB_OUTPUT | |
upload-dbc: | |
name: Generate and Upload DBC to Artifact | |
needs: [ determine-should-run ] | |
if: needs.determine-should-run.outputs.should_run == 'true' | |
runs-on: ubuntu-22.04 | |
container: | |
image: ubcformulaelectric/environment:latest | |
credentials: | |
username: ubcformulaelectric | |
password: ${{ secrets.docker_token }} | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.head_ref }} | |
sparse-checkout: | | |
.github | |
scripts | |
can_bus | |
- name: Make Directory Safe | |
run: git config --global --add safe.directory $(realpath .) | |
- name: Generate DBC | |
uses: ./.github/actions/build_dbc | |
- name: Upload DBC to Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: quadruna.dbc | |
path: quadruna.dbc | |
release-dbc: | |
name: Create Release for DBC | |
runs-on: ubuntu-latest | |
needs: [ upload-dbc ] | |
steps: | |
# ========= DOWNLOAD FILES ========= | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.head_ref }} | |
sparse-checkout: .github | |
- name: Download DBC from Artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: quadruna.dbc | |
- name: Log Files in Current Directory | |
run: ls -l -a | |
# ========= MAKE THE RELEASE ========= | |
- name: Create Release for DBC | |
uses: ./.github/actions/push_release | |
with: | |
files: quadruna.dbc | |
title: "DBC for ${{ github.head_ref }}" | |
body: "DBC for ${{ github.head_ref }} generated by UBC Formula Electric Continuous Integration." | |
tag_name: "${{ github.head_ref }}_tag" | |
latest: false | |
remove-dbc-and-release: | |
name: Remove DBC and Release | |
if: needs.determine-should-run.outputs.should_run == 'false' | |
runs-on: ubuntu-latest | |
needs: | |
- determine-should-run | |
steps: | |
- name: Delete Release | |
uses: dev-drprasad/[email protected] | |
with: | |
tag_name: "${{github.head_ref}}_tag" | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
delete_release: true |