Skip to content

Custom Build

Custom Build #1063

Workflow file for this run

name: Custom Build
on:
discussion_comment:
types: [created]
jobs:
build:
name: Build Custom Firmware
if: contains(github.event.comment.body, '/buildthis')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: phazerville
- name: Setup env
env:
GH_COMMENT: ${{ github.event.comment.body }}
run: |
echo "OC_ARTIFACT_TAG=custom_${GITHUB_ACTOR}-$(sh software/res/oc_build_tag.sh)" | tr '/' '_' >> $GITHUB_ENV
echo "CUSTOM_BUILD_FLAGS=$(python software/res/parse_build_request.py)" >> $GITHUB_ENV
- name: Cache PlatformIO
uses: actions/cache@v4
with:
path: ~/.platformio
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
cache: 'pip'
cache-dependency-path: '**/requirements.txt'
- run: |
pip3 install --upgrade pip
pip3 install -r .github/workflows/requirements.txt
- name: Build firmware
working-directory: software/
run: |
pio run -e custom
- name: Copy artifact
uses: actions/upload-artifact@v4
with:
name: o_C-${{env.OC_ARTIFACT_TAG}}
path: software/.pio/build/*/*.hex
# TODO: this will only work with Issues or Pull Requests...
# - name: Add follow-up comment to discussion
# uses: actions/github-script@v6
# if: always()
# with:
# script: |
# const name = '${{ github.workflow }}';
# const url = '${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}';
# const success = '${{ job.status }}' === 'success';
# const body = `${name}: ${success ? 'succeeded ✅' : 'failed ❌'}\n${url}`;
#
# await github.rest.issues.createComment({
# issue_number: context.issue.number,
# owner: context.repo.owner,
# repo: context.repo.repo,
# body: body
# })