Code clean-up #71
Workflow file for this run
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: HyperSerialESP32 CI Build | |
on: [push] | |
jobs: | |
###################### | |
#### PlatformIO ###### | |
###################### | |
PlatformIO: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/[email protected] | |
- name: Cache pip | |
uses: actions/[email protected] | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Cache PlatformIO | |
uses: actions/[email protected] | |
with: | |
path: ~/.platformio | |
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} | |
- name: Set up Python | |
uses: actions/[email protected] | |
with: | |
python-version: 3.x | |
- name: Install PlatformIO | |
run: | | |
python -m pip install --upgrade pip | |
pip install --upgrade platformio | |
- name: Run PlatformIO | |
run: | | |
pio run | |
zip -j .pio/build/recovery_firmware.zip .pio/build/*.factory.bin | |
rm -f .pio/build/*.factory.bin | |
- uses: actions/[email protected] | |
name: Upload artifacts (commit) | |
if: (startsWith(github.event.ref, 'refs/tags') != true) | |
with: | |
path: | | |
.pio/build/*.bin | |
.pio/build/recovery_firmware.zip | |
- uses: actions/[email protected] | |
name: Upload artifacts (release) | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
name: firmware-release-generic | |
path: | | |
.pio/build/*.bin | |
.pio/build/recovery_firmware.zip | |
################################ | |
###### Publish Releases ######## | |
################################ | |
publish: | |
name: Publish Releases | |
if: startsWith(github.event.ref, 'refs/tags') | |
needs: [PlatformIO] | |
runs-on: ubuntu-latest | |
steps: | |
# generate environment variables | |
- name: Generate environment variables from version and tag | |
run: | | |
echo "TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV | |
echo "preRelease=false" >> $GITHUB_ENV | |
# If version contains alpha or beta, mark draft release as pre-release | |
- name: Mark release as pre-release | |
if: contains(env.VERSION, 'alpha') || contains(env.VERSION, 'beta') | |
run: echo "preRelease=true" >> $GITHUB_ENV | |
- uses: actions/[email protected] | |
with: | |
name: firmware-release | |
pattern: firmware-release-* | |
merge-multiple: true | |
# create draft release and upload artifacts | |
- name: Create draft release | |
uses: softprops/[email protected] | |
with: | |
name: HyperSerialESP32 ${{ env.VERSION }} | |
tag_name: ${{ env.TAG }} | |
files: | | |
*.bin | |
*.zip | |
draft: true | |
prerelease: ${{ env.preRelease }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |