-
Notifications
You must be signed in to change notification settings - Fork 0
50 lines (41 loc) · 1.45 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
name: PlatformIO CI
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
~/.cache/pip
~/.platformio/.cache
key: ${{ runner.os }}-pio
- uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Install PlatformIO Core
run: pip install --upgrade platformio
- name: Build PlatformIO Project
run: platformio run
- uses: actions-ecosystem/action-get-latest-tag@v1
id: get-latest-tag
- name: get new release version
id: get_new_version
run: |
BUILD_DATE=$(date +'%Y.%m')
LATEST_TAG=${{ steps.get-latest-tag.outputs.tag }}
MAJOR_MINOR_LATEST=$(awk -F. '{ OFS = "." } ; { print $1,$2 }' <<< $LATEST_TAG)
NEW_PATCH="0"
if [[ "$BUILD_DATE" = "$MAJOR_MINOR_LATEST" ]];
then
PATCH_LATEST=$(awk -F. '{ print $3 }') <<< $LATEST_TAG
NEW_PATCH=$((PATCH_LATEST + 1))
fi
echo "release_version=$BUILD_DATE.$NEW_PATCH" >> $GITHUB_OUTPUT
- uses: softprops/action-gh-release@v1
with:
name: ${{ steps.get_new_version.outputs.release_version }}
tag_name: ${{ steps.get_new_version.outputs.release_version }}
files: |
.pio/build/nodemcu-32s/firmware.bin