-
Notifications
You must be signed in to change notification settings - Fork 12
45 lines (43 loc) · 1.85 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
name: Build
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: codeberg_sync
run: |
git remote add --mirror=fetch secondary https://${{ secrets.CODEBERG_AUTH }}@codeberg.org/eh2k/squares-and-circles.git
git fetch origin
git push secondary --all --force
- name: Set up Python
uses: actions/setup-python@v2
- name: build
run: |
set -x
python -m pip install --upgrade pip
curl -fLO https://github.com/xpack-dev-tools/arm-none-eabi-gcc-xpack/releases/download/v10.3.1-2.1/xpack-arm-none-eabi-gcc-10.3.1-2.1-linux-x64.tar.gz
cat xpack-arm-none-eabi-gcc-10.3.1-2.1-linux-x64.tar.gz | tar xvz -C . > /dev/null
export GCC_PATH=/$(realpath .)/xpack-arm-none-eabi-gcc-10.3.1-2.1/bin/
export PATH="${PATH}:/$(realpath .)/xpack-arm-none-eabi-gcc-10.3.1-2.1/bin/"
arm-none-eabi-gcc --version
pip install intelhex subprocess32 pyelftools Jinja2 platformio
find ./app -type f -name *.bin -exec touch {} +
git submodule update --init
sh ./app/build.sh
git status
- name: pack_artifacts
run: |
export hash=$(git rev-parse --short HEAD)
for f in .pio/build/*/*.hex; do
FIRMWARE=$(basename $(dirname ${f%.*}))
HEX_FILE=./${FIRMWARE}_engines_$hash.hex
ZIP_FILE=./${FIRMWARE}_engines_$hash.zip
mv -v "$f" $HEX_FILE
zip -j -9 $ZIP_FILE $HEX_FILE .github/workflows/LICENSE.txt $(dirname ${f%.*})/loader.sha
sha256sum $ZIP_FILE
curl -fs -X PUT -u ${{ secrets.UPLOAD_KEY }} ${{ secrets.LATEST_DROP_FOLDER }}/$ZIP_FILE --upload-file $ZIP_FILE || true
curl -fs -X PUT -u ${{ secrets.UPLOAD_KEY }} ${{ secrets.LATEST_DROP_FOLDER }}/${FIRMWARE}_latest.sha -d "$hash"
done