Skip to content

Merge branch 'main' of https://github.com/Blueforcer/awtrix-light #159

Merge branch 'main' of https://github.com/Blueforcer/awtrix-light

Merge branch 'main' of https://github.com/Blueforcer/awtrix-light #159

Workflow file for this run

name: Compile
permissions:
contents: write
on:
push:
branches: [ main ]
paths:
- 'src/**'
- 'lib/**'
jobs:
compile_firmware:
name: Compile the firmware
runs-on: ubuntu-latest
steps:
- name: Check out the repository
uses: actions/checkout@v3
- name: Cache pip
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Cache PlatformIO
uses: actions/cache@v2
with:
path: ~/.platformio
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
- name: Set up Python
uses: actions/setup-python@v2
- name: Install PlatformIO
run: |
python -m pip install --upgrade pip
pip install --upgrade platformio
- name: Install jq
run: sudo apt-get -y install jq
- name: Extract version number
id: version_number
run: |
echo "::set-output name=firmware_version::$(grep '*VERSION' src/Globals.cpp | cut -d'=' -f2 | sed -r 's/"(.*)";/\1/' | awk '{$1=$1};1')"
- name: Create Versionfile
run: echo '${{ steps.version_number.outputs.firmware_version }}' > version
- name: Run PlatformIO for ulanzi
run: pio run --environment ulanzi
- name: Run PlatformIO for awtrix2_upgrade
run: pio run --environment awtrix2_upgrade
- name: Copy firmware for ulanzi to output directory
run: cp .pio/build/ulanzi/firmware.bin docs/ulanzi_flasher/firmware/firmware.bin
- name: Copy firmware for awtrix2_upgrade to output directory
run: cp .pio/build/awtrix2_upgrade/firmware.bin docs/awtrix2_flasher/firmware/firmware.bin
- name: Create new manifest.json for ulanzi
run: cat docs/ulanzi_flasher/firmware/manifest.json | jq '.version="${{ steps.version_number.outputs.firmware_version }}"' > docs/ulanzi_flasher/firmware/new-manifest.json
- name: Override previous manifest.json for ulanzi
run: mv docs/ulanzi_flasher/firmware/new-manifest.json docs/ulanzi_flasher/firmware/manifest.json
- name: Create new manifest.json for awtrix2_upgrade
run: cat docs/awtrix2_flasher/firmware/manifest.json | jq '.version="${{ steps.version_number.outputs.firmware_version }}"' > docs/awtrix2_flasher/firmware/new-manifest.json
- name: Override previous manifest.json for awtrix2_upgrade
run: mv docs/awtrix2_flasher/firmware/new-manifest.json docs/awtrix2_flasher/firmware/manifest.json
- name: Upload ulanzi firmware as artifact
uses: actions/upload-artifact@v2
with:
name: ulanzi_firmware
path: .pio/build/ulanzi/firmware.bin
- name: Upload awtrix2_upgrade firmware as artifact
uses: actions/upload-artifact@v2
with:
name: awtrix2_upgrade_firmware
path: .pio/build/awtrix2_upgrade/firmware.bin
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.version_number.outputs.firmware_version }}
release_name: Release ${{ steps.version_number.outputs.firmware_version }}
draft: false
prerelease: false
- name: Upload ulanzi Release Asset
id: upload-ulanzi-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: .pio/build/ulanzi/firmware.bin
asset_name: ulanzi_TC001_${{ steps.version_number.outputs.firmware_version }}.bin
asset_content_type: application/octet-stream
- name: Upload awtrix2_upgrade Release Asset
id: upload-awtrix2_upgrade-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: .pio/build/awtrix2_upgrade/firmware.bin
asset_name: old_awtrix2_conversion_${{ steps.version_number.outputs.firmware_version }}.bin
asset_content_type: application/octet-stream
- name: Commit
id: commit
uses: stefanzweifel/git-auto-commit-action@v4