forked from benirose/O_C-BenisphereSuite
-
Notifications
You must be signed in to change notification settings - Fork 37
71 lines (61 loc) · 2.08 KB
/
custom.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
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@v3
with:
ref: phazerville
- name: Setup env
env:
GH_COMMENT: ${{ github.event.comment.body }}
run: |
echo "OC_ARTIFACT_TAG=custom_${GITHUB_ACTOR}-$(software/o_c_REV/resources/oc_build_tag.sh)" | tr '/' '_' >> $GITHUB_ENV
echo "CUSTOM_FLAGS=$(python software/o_c_REV/resources/parse_build_request.py)" >> $GITHUB_ENV
- name: Cache PlatformIO
uses: actions/cache@v3
with:
path: ~/.platformio
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
- name: Set up Python
uses: actions/setup-python@v3
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
env:
CUSTOM_BUILD_FLAGS: ${{env.CUSTOM_FLAGS}}
working-directory: software/o_c_REV/
run: |
pio run -e custom
- name: Copy artifact
uses: actions/upload-artifact@v3
with:
name: o_C-${{env.OC_ARTIFACT_TAG}}
path: software/o_c_REV/.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
# })