Skip to content

Update actions

Update actions #233

Workflow file for this run

name: build
on: [push]
jobs:
build:
strategy:
matrix:
target: [knobby, tdisplay-s3, twatch]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Cache PlatformIO
uses: actions/cache@v4
with:
path: ~/.platformio
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
- name: Set up Python
uses: actions/setup-python@v5
- name: Install PlatformIO
run: |
python -m pip install --upgrade pip
pip install --upgrade platformio
- name: Run PlatformIO
run: |
pio run -e ${{ matrix.target }}
pio run -e ${{ matrix.target }} -t buildfs
mkdir upload
zip -j upload/${{ matrix.target }}-firmware.zip .pio/build/${{ matrix.target }}/*.bin flash.bat flash.sh
zip -j upload/${{ matrix.target }}-elf.zip .pio/build/${{ matrix.target }}/*.elf
- name: Archive firmware zip
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.target }}-firmware
path: upload/${{ matrix.target }}-firmware.zip
- name: Archive firmware elf
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.target }}-elf
path: upload/${{ matrix.target }}-elf.zip
upload:
if: github.repository_owner == 'quadule'
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: ~/artifacts
- name: Merge artifacts
run: |
mkdir upload
cd upload
mv ~/artifacts/*/* .
unzip -p knobby-firmware.zip firmware.bin > knobby.bin
unzip -p tdisplay-s3-firmware.zip firmware.bin > tdisplay-s3.bin
unzip -p twatch-firmware.zip firmware.bin > twatch.bin
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-west-2
- name: Upload branch firmware to S3
if: github.ref_type == 'branch'
run:
aws s3 cp
--metadata "{\"git-version\":\"$(git describe --match="" --dirty --always)\"}"
--recursive
upload
s3://knobby/firmware/${{ github.ref_name }}/
- name: Upload release firmware to S3
if: github.ref_type == 'tag'
run:
mv upload/knobby-firmware.zip upload/knobby-firmware-${{ github.ref_name }}.zip;
mv upload/tdisplay-s3-firmware.zip upload/tdisplay-s3-firmware-${{ github.ref_name }}.zip;
mv upload/twatch-firmware.zip upload/twatch-firmware-${{ github.ref_name }}.zip;
aws s3 cp
--metadata "{\"git-version\":\"$(git describe --match="" --dirty --always)\"}"
--recursive
upload
s3://knobby/firmware/;
unzip -d setup/firmware/knobby upload/knobby-firmware-${{ github.ref_name }}.zip;
unzip -d setup/firmware/tdisplay-s3 upload/tdisplay-s3-firmware-${{ github.ref_name }}.zip;
unzip -d setup/firmware/twatch upload/twatch-firmware-${{ github.ref_name }}.zip;
aws s3 cp
--metadata "{\"git-version\":\"$(git describe --match="" --dirty --always)\"}"
--recursive
--exclude "*" --include "*.bin" --include "*.json" --include "*.html"
setup
s3://setup.knobby.net/;
- name: Draft release
uses: softprops/action-gh-release@v1
if: github.ref_type == 'tag'
with:
draft: true
files: upload/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}