Skip to content

Commit afa36a2

Browse files
committed
Adding PIO publish workflow
1 parent 826fcb3 commit afa36a2

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

.github/workflows/publish.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
2+
3+
name: Publish to PlatformIO
4+
5+
on:
6+
workflow_dispatch:
7+
inputs:
8+
tag_name:
9+
description: "Tag name of the release to publish (use 'latest' for the most recent tag)"
10+
required: true
11+
default: "latest"
12+
13+
jobs:
14+
publish:
15+
name: Publish
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
with:
21+
fetch-tags: true
22+
23+
- name: Download release zip
24+
run: |
25+
if [ "${{ inputs.tag_name }}" == "latest" ]; then
26+
TAG_NAME=$(git tag --sort=-creatordate | head -n 1)
27+
if [ -z "$TAG_NAME" ]; then
28+
echo "Error: No tags found in the repository."
29+
exit 1
30+
fi
31+
else
32+
TAG_NAME="${{ inputs.tag_name }}"
33+
fi
34+
echo "Downloading tag: $TAG_NAME"
35+
curl -L -o project.zip "https://github.com/${{ github.repository }}/archive/refs/tags/$TAG_NAME.zip"
36+
37+
- name: Cache PlatformIO
38+
uses: actions/cache@v4
39+
with:
40+
key: ${{ runner.os }}-pio
41+
path: |
42+
~/.cache/pip
43+
~/.platformio
44+
45+
- name: Python
46+
uses: actions/setup-python@v5
47+
with:
48+
python-version: "3.x"
49+
50+
- name: Install PlatformIO CLI
51+
run: |
52+
python -m pip install --upgrade pip
53+
pip install --upgrade platformio
54+
55+
- name: Publish to PlatformIO
56+
run: pio pkg publish --owner ESP32Async project.zip
57+
env:
58+
PLATFORMIO_AUTH_TOKEN: ${{ secrets.PLATFORMIO_AUTH_TOKEN }}

0 commit comments

Comments
 (0)