Skip to content

get latest tag

get latest tag #14

Workflow file for this run

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