Update platformio.ini #1
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: HyperSPI ESP32/8266 CI Build | |
on: [push] | |
jobs: | |
###################### | |
#### PlatformIO ###### | |
###################### | |
PlatformIO: | |
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 | |
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/upload-artifact@v4 | |
name: Upload artifacts (commit) | |
if: (startsWith(github.event.ref, 'refs/tags') != true) | |
with: | |
name: firmware-archive | |
path: | | |
.pio/build/*.bin | |
.pio/build/recovery_firmware.zip | |
- uses: actions/upload-artifact@v4 | |
name: Upload artifacts (release) | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
name: firmware-release | |
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/download-artifact@v4 | |
with: | |
name: firmware-release | |
# create draft release and upload artifacts | |
- name: Create draft release | |
uses: softprops/action-gh-release@v1 | |
with: | |
name: HyperSPI ${{ env.VERSION }} | |
tag_name: ${{ env.TAG }} | |
files: | | |
*.bin | |
*.zip | |
draft: true | |
prerelease: ${{ env.preRelease }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |