-
Notifications
You must be signed in to change notification settings - Fork 96
108 lines (91 loc) · 3.44 KB
/
build.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
name: 'Build'
on:
push:
branches:
- dev
tags:
- '*'
pull_request:
jobs:
build:
runs-on: [self-hosted,FlipperZeroShell]
steps:
- name: 'Store UID'
id: uid
run: |
echo id="$(id -u $USER)" >> $GITHUB_OUTPUT
- name: 'Wipe workspace'
run: find ./ -mount -maxdepth 1 -exec rm -rf {} \;
- name: 'Checkout code'
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 1
- name: 'Checkout submodules'
run:
git submodule update --init --recursive --depth 1 --jobs "$(getconf _NPROCESSORS_ONLN)";
- name: 'Setup python'
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: 'Get commit details'
id: names
run: |
if [[ ${{ github.event_name }} == 'pull_request' ]]; then
TYPE="pull"
elif [[ "${{ github.ref }}" == "refs/tags/"* ]]; then
TYPE="tag"
else
TYPE="other"
fi
python3 scripts/get_env.py "--event_file=${{ github.event_path }}" "--type=$TYPE"
echo "event_type=$TYPE" >> $GITHUB_OUTPUT
- name: 'Setup node'
uses: actions/setup-node@v3
with:
node-version: '17'
cache: 'npm'
cache-dependency-path: components/svelte-portal
- name: 'Install node dependencies'
run: npm install
working-directory: components/svelte-portal
- name: 'Build captive portal'
run: npm run build
working-directory: components/svelte-portal
- name: 'Build firmware'
uses: Intake-Health/[email protected]
- name: 'Fix ownership'
uses: peter-murray/reset-workspace-ownership-action@v1
with:
user_id: ${{ steps.uid.outputs.id }}
- name: 'Make artifacts directory'
if: ${{ !github.event.pull_request.head.repo.fork }}
run: |
rm -rf artifacts
mkdir artifacts
- name: 'Move upload files'
if: ${{ !github.event.pull_request.head.repo.fork }}
run: |
mv build/bootloader/bootloader.bin artifacts/
mv build/partition_table/partition-table.bin artifacts/
mv build/blackmagic.bin artifacts/
cp scripts/flash_nix.sh artifacts/
- name: 'Generate flash.command file'
if: ${{ !github.event.pull_request.head.repo.fork }}
run: |
echo "esptool.py -p (PORT) -b 460800 --before default_reset --after hard_reset --chip esp32s2 write_flash $(tr '\n' ' ' < build/flash_args)" > artifacts/flash.command
sed -i 's/partition_table\///g' artifacts/flash.command
sed -i 's/bootloader\///g' artifacts/flash.command
- name: 'Generate archive'
if: ${{ !github.event.pull_request.head.repo.fork }}
run: |
mkdir -p "artifacts-archive"
tar -czvf artifacts-archive/blackmagic-firmware-s2-full-${SUFFIX}.tgz -C artifacts/ .
- name: 'Upload artifacts to update server'
if: ${{ !github.event.pull_request.head.repo.fork }}
run: |
FILES=$(for CUR in $(ls artifacts-archive/); do echo "-F files=@artifacts-archive/$CUR"; done)
curl --fail -L -H "Token: ${{ secrets.INDEXER_TOKEN }}" \
-F "branch=${BRANCH_NAME}" \
${FILES[@]} \
"${{ secrets.INDEXER_URL }}"/blackmagic-firmware/uploadfiles