diff --git a/.github/workflows/auto_release.yml b/.github/workflows/auto_release.yml index a8b34d2..a355d1a 100644 --- a/.github/workflows/auto_release.yml +++ b/.github/workflows/auto_release.yml @@ -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_BUILD=$(echo $LATEST_TAG | awk -F_ '{print $2}') - NEXT_BUILD=$(printf "%03d" $((PREVIOUS_BUILD + 1))) + PREVIOUS_VERSION=$(echo $LATEST_TAG | awk -F_ '{print $1}' | awk -F- '{print $2}') + PREVIOUS_BUILD=$(echo $LATEST_TAG | awk -F_ '{print $2}') + + 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