Update auto_release.yml

This commit is contained in:
Gerrit Gogel 2023-10-18 21:38:30 +02:00
parent a21eae4941
commit 3b618557fc

View file

@ -27,11 +27,19 @@ jobs:
LATEST_TAG=$(git describe --tags --abbrev=0 --match "${{ matrix.folder }}-*" 2>/dev/null)
echo "LATEST_TAG=$LATEST_TAG" >> $GITHUB_ENV
if [[ -n "$LATEST_TAG" ]]; then
PREVIOUS_VERSION=$(echo $LATEST_TAG | awk -F_ '{print $1}' | awk -F- '{print $2}')
PREVIOUS_BUILD=$(echo $LATEST_TAG | awk -F_ '{print $2}')
NEXT_BUILD=$(printf "%03d" $((PREVIOUS_BUILD + 1)))
if [[ "${{ matrix.folder }}" == "seafile-caddy" ]]; then
CURRENT_VERSION=$(grep -m 1 'FROM caddy:' ${{ matrix.folder }}/Dockerfile | awk -F':' '{print $2}' | awk -F'-' '{print $1}' | tr -d '\n')
else
CURRENT_VERSION=$(grep -m 1 'SEAFILE_VERSION' ${{ matrix.folder }}/Dockerfile | awk -F'SEAFILE_VERSION=' '{print $2}' | awk '{print $1}' | tr -d '\n')
fi
if [[ "$PREVIOUS_VERSION" != "$CURRENT_VERSION" ]] || [[ -z "$LATEST_TAG" ]]; then
NEXT_BUILD="001"
else
NEXT_BUILD=$(printf "%03d" $((PREVIOUS_BUILD + 1)))
fi
echo "NEXT_BUILD=$NEXT_BUILD" >> $GITHUB_ENV