mirror of
https://github.com/m5stack/build.git
synced 2026-05-20 11:48:25 -07:00
Use next patch version when using main action script
Updated the version resolution logic to prefer workflow input and increment the patch version correctly. This will prevent auto downgrading from stable repository.
This commit is contained in:
+27
-3
@@ -140,9 +140,33 @@ runs:
|
||||
- shell: bash
|
||||
run: |
|
||||
|
||||
# read version from upstream Armbian OS
|
||||
cat os/stable.json | jq '.version' | sed "s/\"//g" | sed 's/^/ARMBIAN_VERSION=/' >> $GITHUB_ENV
|
||||
[[ "${{ inputs.armbian_version }}" != '' ]] && echo "ARMBIAN_VERSION=${{ inputs.armbian_version }}" >> $GITHUB_ENV
|
||||
# Resolve base version (prefer workflow input if provided)
|
||||
BASE_VERSION="${{ inputs.armbian_version }}"
|
||||
if [ -z "$BASE_VERSION" ]; then
|
||||
BASE_VERSION="$(jq -r '.version' os/stable.json)"
|
||||
fi
|
||||
|
||||
# Preserve optional 'v' prefix but strip it for math
|
||||
PREFIX=''
|
||||
if [[ "$BASE_VERSION" == v* ]]; then
|
||||
PREFIX='v'
|
||||
BASE_NO_PREFIX="${BASE_VERSION#v}"
|
||||
else
|
||||
BASE_NO_PREFIX="$BASE_VERSION"
|
||||
fi
|
||||
|
||||
# Drop any pre-release/build metadata (e.g., -rc1, +meta)
|
||||
CORE="${BASE_NO_PREFIX%%[-+]*}"
|
||||
|
||||
# Split and increment patch
|
||||
IFS='.' read -r MAJOR MINOR PATCH <<<"$CORE"
|
||||
PATCH=${PATCH:-0}
|
||||
NEXT_PATCH=$((PATCH + 1))
|
||||
NEXT_VERSION="${PREFIX}${MAJOR}.${MINOR}.${NEXT_PATCH}"
|
||||
|
||||
{
|
||||
echo "ARMBIAN_VERSION=${NEXT_VERSION}"
|
||||
} >> "$GITHUB_ENV"
|
||||
|
||||
# copy os userpatches and custom
|
||||
mkdir -pv build/userpatches
|
||||
|
||||
Reference in New Issue
Block a user