File tree Expand file tree Collapse file tree 1 file changed +62
-0
lines changed
Expand file tree Collapse file tree 1 file changed +62
-0
lines changed Original file line number Diff line number Diff line change 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+ fetch-depth : 0 # Ensure all commits and tags are fetched
23+
24+ - name : Show latest tag
25+ run : git tag --sort=-creatordate | head -n 1
26+
27+ - name : Download release zip
28+ run : |
29+ if [ "${{ inputs.tag_name }}" == "latest" ]; then
30+ TAG_NAME=$(git tag --sort=-creatordate | head -n 1)
31+ if [ -z "$TAG_NAME" ]; then
32+ echo "Error: No tags found in the repository."
33+ exit 1
34+ fi
35+ else
36+ TAG_NAME="${{ inputs.tag_name }}"
37+ fi
38+ echo "Downloading tag: $TAG_NAME"
39+ curl -L -o project.zip "https://github.com/${{ github.repository }}/archive/refs/tags/$TAG_NAME.zip"
40+
41+ - name : Cache PlatformIO
42+ uses : actions/cache@v4
43+ with :
44+ key : ${{ runner.os }}-pio
45+ path : |
46+ ~/.cache/pip
47+ ~/.platformio
48+
49+ - name : Python
50+ uses : actions/setup-python@v5
51+ with :
52+ python-version : " 3.x"
53+
54+ - name : Install PlatformIO CLI
55+ run : |
56+ python -m pip install --upgrade pip
57+ pip install --upgrade platformio
58+
59+ - name : Publish to PlatformIO
60+ run : pio pkg publish --no-interactive --owner ${{ github.repository_owner }} project.zip
61+ env :
62+ PLATFORMIO_AUTH_TOKEN : ${{ secrets.PLATFORMIO_AUTH_TOKEN }}
You can’t perform that action at this time.
0 commit comments