Publish to PlatformIO #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
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json | |
name: Publish to PlatformIO | |
on: | |
workflow_dispatch: | |
inputs: | |
tag_name: | |
description: "Tag name of the release to publish (use 'latest' for the most recent tag)" | |
required: true | |
default: "latest" | |
jobs: | |
publish: | |
name: Publish | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-tags: true | |
- name: Download release zip | |
run: | | |
if [ "${{ inputs.tag_name }}" == "latest" ]; then | |
TAG_NAME=$(git tag --sort=-creatordate | head -n 1) | |
if [ -z "$TAG_NAME" ]; then | |
echo "Error: No tags found in the repository." | |
exit 1 | |
fi | |
else | |
TAG_NAME="${{ inputs.tag_name }}" | |
fi | |
echo "Downloading tag: $TAG_NAME" | |
curl -L -o project.zip "https://github.com/${{ github.repository }}/archive/refs/tags/$TAG_NAME.zip" | |
- name: Cache PlatformIO | |
uses: actions/cache@v4 | |
with: | |
key: ${{ runner.os }}-pio | |
path: | | |
~/.cache/pip | |
~/.platformio | |
- name: Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.x" | |
- name: Install PlatformIO CLI | |
run: | | |
python -m pip install --upgrade pip | |
pip install --upgrade platformio | |
- name: Publish to PlatformIO | |
run: pio pkg publish --owner ESP32Async project.zip | |
env: | |
PLATFORMIO_AUTH_TOKEN: ${{ secrets.PLATFORMIO_AUTH_TOKEN }} |