Skip to content

Style

Style #258

Workflow file for this run

name: PlatformIO CI
on:
workflow_call:
inputs:
major:
required: true
type: string
minor:
required: true
type: string
patch:
required: true
type: string
outputs:
artifact:
description: "The first output string"
value: ${{ jobs.build.outputs.artifact }}
push:
branches:
- master
- release/*
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Get current branch
id: branch
run: echo "branch=${GITHUB_REF##*/}" >> $GITHUB_OUTPUT
- name: Get current datetime
id: datetime
run: echo "datetime=$(date +'%Y%m%dT%H%M%S')" >> $GITHUB_OUTPUT
- name: Get current time
id: time
run: echo "time=$(date +'%H%M%S')" >> $GITHUB_OUTPUT
- name: Get version
id: version
shell: bash
run: |
if [ -z "${{ inputs.major }}" ]
then
echo "version=${{ steps.time.outputs.time }}" >> $GITHUB_OUTPUT
else
echo "version=${{ inputs.major }}.${{ inputs.minor }}.${{ inputs.patch }}" >> $GITHUB_OUTPUT
fi
- uses: actions/checkout@v3
- name: Cache pip
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: '${{ runner.os }}-pip-${{ hashFiles(''**/requirements.txt'') }}'
restore-keys: |
${{ runner.os }}-pip-
- name: Cache PlatformIO
uses: actions/cache@v3
with:
path: ~/.platformio
key: '${{ runner.os }}-${{ hashFiles(''**/lockfiles'') }}'
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install PlatformIO
run: |
python -m pip install --upgrade pip
pip install --upgrade platformio
- name: Install libs
run: |
cd SmartEVSE-3
pio lib install
- name: Build normal version
run: PLATFORMIO_BUILD_FLAGS='-DVERSION=\"SERKRI-${{ steps.version.outputs.version }}\" -DDBG=0' pio run -d SmartEVSE-3/
- name: Build spiffs
run: PLATFORMIO_BUILD_FLAGS='-DVERSION=\"SERKRI-${{ steps.version.outputs.version }}\" -DDBG=0' pio run -d SmartEVSE-3/ -t buildfs
- id: artifact
run: echo "value=dist-${{ steps.branch.outputs.branch }}-${{ steps.datetime.outputs.datetime }}" >> $GITHUB_OUTPUT
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: ${{ steps.artifact.outputs.value }}
path: ./SmartEVSE-3/.pio/build/release/*.bin
retention-days: 10
- name: Upload HowToFlash.txt
uses: actions/upload-artifact@v3
with:
name: ${{ steps.artifact.outputs.value }}
path: ./SmartEVSE-3/HowToFlash.txt
retention-days: 10
- name: Build debug version
run: |
PLATFORMIO_BUILD_FLAGS='-DVERSION=\"SERKRI-${{ steps.version.outputs.version }}\" -DDBG=1' pio run -d SmartEVSE-3/
mv ./SmartEVSE-3/.pio/build/release/firmware.bin ./SmartEVSE-3/.pio/build/release/firmware.debug.bin
- name: Upload Artifact debug firmware
uses: actions/upload-artifact@v3
with:
name: ${{ steps.artifact.outputs.value }}
path: ./SmartEVSE-3/.pio/build/release/firmware.debug.bin
retention-days: 10
outputs:
artifact: ${{ steps.artifact.outputs.value }}