Skip to content

Commit 66d32ba

Browse files
committed
workflow
1 parent da76ebf commit 66d32ba

1 file changed

Lines changed: 21 additions & 7 deletions

File tree

.github/workflows/main.yml

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
name: PlatformIO Release Build
1+
name: PlatformIO Auto Release
22

33
on:
44
push:
5-
tags:
6-
- 'v*'
7-
workflow_dispatch:
5+
branches: [ main ] # runs automatically on every push to main
86

97
jobs:
108
build:
@@ -13,6 +11,8 @@ jobs:
1311
steps:
1412
- name: Checkout repository
1513
uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 0
1616

1717
- name: Set up Python
1818
uses: actions/setup-python@v5
@@ -41,15 +41,29 @@ jobs:
4141
- name: Build firmware
4242
run: pio run
4343

44-
- name: Rename firmware
44+
- name: Prepare firmware output
4545
run: |
4646
mkdir output
47-
find .pio/build -name "firmware.bin" -exec bash -c 'cp "$0" "output/${0##*/}"' {} \;
47+
find .pio/build -name "firmware.bin" -exec bash -c 'cp "$0" "output/${0%/*}.bin"' {} \;
4848
ls -lh output
4949
50-
- name: Create GitHub release and upload firmware
50+
- name: Auto increment release tag
51+
id: tag
52+
run: |
53+
latest_tag=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0")
54+
echo "Latest tag: $latest_tag"
55+
base=${latest_tag#v}
56+
IFS='.' read -r major minor patch <<< "$base"
57+
new_tag="v$major.$minor.$((patch+1))"
58+
echo "new_tag=$new_tag" >> $GITHUB_ENV
59+
echo "Next tag: $new_tag"
60+
61+
- name: Create GitHub Release
5162
uses: softprops/action-gh-release@v2
5263
with:
64+
tag_name: ${{ env.new_tag }}
65+
name: "Auto Release ${{ env.new_tag }}"
66+
generate_release_notes: true
5367
files: output/*.bin
5468
env:
5569
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)