update auto_release workflow

This commit is contained in:
Gerrit Gogel 2023-08-26 17:34:52 +02:00
parent 3c185c43f4
commit 2b04124c61

View file

@ -42,7 +42,6 @@ jobs:
exit 0 exit 0
fi fi
echo "FOLDER_CHANGED=$FOLDER_CHANGED"
echo "FOLDER_CHANGED=$FOLDER_CHANGED" >> $GITHUB_ENV echo "FOLDER_CHANGED=$FOLDER_CHANGED" >> $GITHUB_ENV
if [[ -f "$FOLDER_CHANGED/Dockerfile" ]]; then if [[ -f "$FOLDER_CHANGED/Dockerfile" ]]; then
@ -58,18 +57,15 @@ jobs:
"https://api.github.com/repos/${{ github.repository }}/tags?per_page=100" | \ "https://api.github.com/repos/${{ github.repository }}/tags?per_page=100" | \
jq -r --arg FOLDER "$FOLDER_CHANGED" --arg VERSION "$SEAFILE_VERSION" '.[] | select(.name | startswith($FOLDER + "-" + $VERSION)) | .name' | sort -V | tail -1) jq -r --arg FOLDER "$FOLDER_CHANGED" --arg VERSION "$SEAFILE_VERSION" '.[] | select(.name | startswith($FOLDER + "-" + $VERSION)) | .name' | sort -V | tail -1)
echo "LATEST_TAG=$LATEST_TAG"
echo "LATEST_TAG=$LATEST_TAG" >> $GITHUB_ENV echo "LATEST_TAG=$LATEST_TAG" >> $GITHUB_ENV
if [[ $LATEST_TAG ]]; then if [[ $LATEST_TAG ]]; then
PREVIOUS_BUILD=$(echo $LATEST_TAG | awk -F_ '{print $2}') PREVIOUS_BUILD=$(echo $LATEST_TAG | awk -F_ '{print $2}')
echo "PREVIOUS_BUILD=$PREVIOUS_BUILD"
NEXT_BUILD=$(printf "%03d" $((PREVIOUS_BUILD + 1))) NEXT_BUILD=$(printf "%03d" $((PREVIOUS_BUILD + 1)))
else else
NEXT_BUILD="001" NEXT_BUILD="001"
fi fi
echo "NEXT_BUILD=$NEXT_BUILD" >> $GITHUB_ENV echo "NEXT_BUILD=$NEXT_BUILD" >> $GITHUB_ENV
echo "NEXT_BUILD = $NEXT_BUILD"
- name: Get Commit Messages - name: Get Commit Messages
if: env.FOLDER_CHANGED != '' && env.SEAFILE_VERSION != '' if: env.FOLDER_CHANGED != '' && env.SEAFILE_VERSION != ''
@ -91,7 +87,7 @@ jobs:
done done
MESSAGES="Seafile version: $SEAFILE_VERSION"$'\n'"Image build version: $NEXT_BUILD"$'\n'"Changelog:"$'\n'"$MESSAGES" MESSAGES="Seafile version: $SEAFILE_VERSION"$'\n'"Image build version: $NEXT_BUILD"$'\n'"Changelog:"$'\n'"$MESSAGES"
echo "::set-output name=formatted_messages::${MESSAGES//$'\n'/'%0A'}" echo "FORMATTED_MESSAGES=${MESSAGES//$'\n'/'%0A'}" >> $GITHUB_ENV
- name: Create Release - name: Create Release
if: env.FOLDER_CHANGED != '' && env.SEAFILE_VERSION != '' if: env.FOLDER_CHANGED != '' && env.SEAFILE_VERSION != ''
@ -101,6 +97,6 @@ jobs:
with: with:
tag_name: ${{ env.FOLDER_CHANGED }}-${{ env.SEAFILE_VERSION }}_${{ env.NEXT_BUILD }} tag_name: ${{ env.FOLDER_CHANGED }}-${{ env.SEAFILE_VERSION }}_${{ env.NEXT_BUILD }}
release_name: ${{ env.FOLDER_CHANGED }}-${{ env.SEAFILE_VERSION }}_${{ env.NEXT_BUILD }} release_name: ${{ env.FOLDER_CHANGED }}-${{ env.SEAFILE_VERSION }}_${{ env.NEXT_BUILD }}
body: ${{ steps.get_messages.outputs.formatted_messages }} body: ${{ env.FORMATTED_MESSAGES }}
draft: false draft: false
prerelease: false prerelease: false