mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-07-26 23:08:11 +00:00
47 lines
1.6 KiB
YAML
47 lines
1.6 KiB
YAML
name: Setup Build Environment
|
|
runs:
|
|
using: "composite"
|
|
steps:
|
|
|
|
- name: Init Cache
|
|
uses: actions/cache@v5
|
|
with:
|
|
path: |
|
|
~/.cache/pip
|
|
~/.platformio/.cache
|
|
key: ${{ runner.os }}-pio
|
|
|
|
- name: Install Python
|
|
uses: actions/setup-python@v6
|
|
with:
|
|
python-version: '3.13'
|
|
|
|
- name: Install PlatformIO
|
|
shell: bash
|
|
run: |
|
|
pip install --upgrade platformio
|
|
|
|
# a git tag of "room-server-v1.2.3" should set "v1.2.3" as GIT_TAG_VERSION
|
|
# a git tag of "wio-tracker-v1.15-plus.1.3" should set "v1.15-plus.1.3" as GIT_TAG_VERSION
|
|
# a git tag of "v1.11" should set "v1.11" as GIT_TAG_VERSION
|
|
- name: Extract Version from Git Tag
|
|
shell: bash
|
|
run: |
|
|
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
|
|
# triggered by a tag push -- keep this fork's own tag conventions:
|
|
# "room-server-v1.2.3" -> "v1.2.3"
|
|
# "wio-tracker-v1.15-plus.1.3" -> "v1.15-plus.1.3"
|
|
# "v1.11" -> "v1.11"
|
|
GIT_TAG_NAME="${GITHUB_REF#refs/tags/}"
|
|
case "$GIT_TAG_NAME" in
|
|
v*) VERSION_STRING="${GIT_TAG_NAME}" ;;
|
|
*) VERSION_STRING="v${GIT_TAG_NAME#*-v}" ;;
|
|
esac
|
|
else
|
|
# triggered by a workflow dispatch (e.g: refs/heads/main)
|
|
# strip "refs/heads/" prefix and replace any remaining "/" with "-" to protect file paths
|
|
BRANCH_NAME="${GITHUB_REF#refs/heads/}"
|
|
VERSION_STRING=$(echo "$BRANCH_NAME" | tr '/' '-')
|
|
fi
|
|
echo "GIT_TAG_VERSION=${VERSION_STRING}" >> $GITHUB_ENV
|