Create FUNDING.yml #89
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |