-
-
Notifications
You must be signed in to change notification settings - Fork 16
86 lines (70 loc) · 3.16 KB
/
build-test.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
name: Build, test, upload
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
jobs:
build:
runs-on: [ubuntu-latest]
env:
APP_NAME: fdskey
OUT_DIR: fdskey
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install compiler
run: sudo apt-get install gcc-arm-none-eabi
- name: Build bootloader
run: |
mkdir -p ${{ env.OUT_DIR }}
make -C FdsKey_bootloader/interim/ OBJCOPY_BIN=../../${{ env.OUT_DIR }}/bootloader.bin EXECUTABLES=../../${{ env.OUT_DIR }}/bootloader.elf
- name: Build firmware
run: |
mkdir -p ${{ env.OUT_DIR }}
make -C FdsKey/interim/ OBJCOPY_BIN=../../${{ env.OUT_DIR }}/${{ env.APP_NAME }}.bin EXECUTABLES=../../${{ env.OUT_DIR }}/${{ env.APP_NAME }}.elf
- name: Archive
working-directory: ${{ env.OUT_DIR }}
run: |
tar -czvf ../${{ env.APP_NAME }}.tar.gz *
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: ${{ env.APP_NAME }}
path: ${{ env.OUT_DIR }}
upload-to-pages:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v3
- name: Move files to the root
run: find -mindepth 2 -exec mv {} . \;
- name: Calculate and save MD5 for each file
run: |
for file in *; do
if [ -f "$file" ]; then
md5sum "$file" | awk '{print $1}' > "${file}.md5"
fi
done
- name: Generate index.html
run: |
echo "<html><head><title>FDSKey</title></head><meta http-equiv='Cache-Control' content='no-cache, no-store, must-revalidate'/>" > index.html
echo "<body>Updated: `date`<br/><br/>" >> index.html
echo "Main firmware (.bin): <a href='fdskey.bin'>fdskey.bin</a><br/><small>(MD5: <a href='fdskey.bin.md5'>`cat fdskey.bin.md5`</a>)</small></br>Put the <b>fdskey.bin</b> file on a microSD card and hold all four buttons during power-on to update the firmware. Or use a programmer and write it to the 0x08020000 address.<br/><br/>" >> index.html
echo "Main firmware (.elf): <a href='fdskey.elf'>fdskey.elf</a><br/><small>(MD5: <a href='fdskey.elf.md5'>`cat fdskey.elf.md5`</a>)</small></br>Use this file to write firmware using programmer.<br/><br/>" >> index.html
echo "Bootloader (.bin): <a href='bootloader.bin'>bootloader.bin</a><br/><small>(MD5: <a href='bootloader.bin.md5'>`cat bootloader.bin.md5`</a>)</small></br>You can use it to update the bootloader via the service menu. Or use a programmer and write it to the 0x08000000 address.<br/><br/>" >> index.html
echo "Bootloader (.elf): <a href='bootloader.elf'>bootloader.elf</a><br/><small>(MD5: <a href='bootloader.elf.md5'>`cat bootloader.elf.md5`</a>)</small></br>Use this file to write the bootloader using programmer.<br/><br/>" >> index.html
echo "</body></html>" >> index.html
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: '.'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1