From 3ff0f8b7ab3afdea6aed1d12ec7c88011578cada Mon Sep 17 00:00:00 2001 From: Vladimir Dubrovin <3proxy@3proxy.ru> Date: Wed, 26 Aug 2026 15:22:38 +0300 Subject: [PATCH] Update devel workflows (cherry picked from commit 845df7d196788013b016c3e9b89503dfdf7ec228) --- .github/workflows/update-docs.yml | 1 + .github/workflows/update-version.yml | 33 ++++++++++++++++++++-------- .github/workflows/update-wiki.yml | 3 +++ 3 files changed, 28 insertions(+), 9 deletions(-) diff --git a/.github/workflows/update-docs.yml b/.github/workflows/update-docs.yml index c3569a2..06b449a 100644 --- a/.github/workflows/update-docs.yml +++ b/.github/workflows/update-docs.yml @@ -2,6 +2,7 @@ name: Update HTML documentation on: push: + branches: [master] paths: - 'man/**' workflow_dispatch: diff --git a/.github/workflows/update-version.yml b/.github/workflows/update-version.yml index c2f4967..f128477 100644 --- a/.github/workflows/update-version.yml +++ b/.github/workflows/update-version.yml @@ -4,6 +4,7 @@ on: push: paths: - RELEASE + - DEVEL workflow_dispatch: permissions: @@ -19,12 +20,23 @@ jobs: - name: Regenerate version files run: | - RELEASE=$(tr -d ' \t\r\n' < RELEASE) - if [ -z "$RELEASE" ]; then echo "RELEASE is empty"; exit 1; fi - MAJOR=$(echo "$RELEASE" | cut -d . -f 1) - SUBMAJOR=$(echo "$RELEASE" | cut -d . -f 2) - MINOR=$(echo "$RELEASE" | cut -d . -f 3) - SUBMINOR=$(echo "$RELEASE" | cut -d . -f 4) + # A release branch carries RELEASE, a development branch DEVEL, whose + # version may have a suffix such as 2.0.0-devel. + if [ -f RELEASE ]; then VERFILE=RELEASE + elif [ -f DEVEL ]; then VERFILE=DEVEL + else echo "neither RELEASE nor DEVEL is present"; exit 1 + fi + RELEASE=$(tr -d ' \t\r\n' < "$VERFILE") + if [ -z "$RELEASE" ]; then echo "$VERFILE is empty"; exit 1; fi + + # the numbered fields take the numeric part, the strings keep all of it + NUMBERS=${RELEASE%%[!0-9.]*} + NUMBERS=${NUMBERS%.} + if [ -z "$NUMBERS" ]; then echo "no version number in '$RELEASE'"; exit 1; fi + MAJOR=$(echo "$NUMBERS" | cut -d . -f 1) + SUBMAJOR=$(echo "$NUMBERS" | cut -d . -f 2) + MINOR=$(echo "$NUMBERS" | cut -d . -f 3) + SUBMINOR=$(echo "$NUMBERS" | cut -d . -f 4) [ -n "$SUBMAJOR" ] || SUBMAJOR=0 [ -n "$MINOR" ] || MINOR=0 [ -n "$SUBMINOR" ] || SUBMINOR=0 @@ -39,7 +51,10 @@ jobs: else BUILDDATE=$(date -u +%y%m%d%H%M%S) fi - echo "release $RELEASE -> $MAJOR $SUBMAJOR $MINOR $SUBMINOR, build date $BUILDDATE" + # rpm refuses a hyphen in Version, so a suffix becomes a tilde, which + # also sorts before the release of the same number + RPMVERSION=$(echo "$RELEASE" | tr '-' '~') + echo "$VERFILE $RELEASE -> $MAJOR $SUBMAJOR $MINOR $SUBMINOR, rpm $RPMVERSION, build date $BUILDDATE" SOURCE_DATE_EPOCH=$(date -u -d "20${BUILDDATE:0:2}-${BUILDDATE:2:2}-${BUILDDATE:4:2} ${BUILDDATE:6:2}:${BUILDDATE:8:2}:${BUILDDATE:10:2}" +%s) YEAR=$(date -u -d @$SOURCE_DATE_EPOCH +%Y) @@ -59,7 +74,7 @@ jobs: mv scripts/rh/3proxy.spec scripts/rh/3proxy.spec.old { echo "Name: 3proxy" - echo "Version: $RELEASE" + echo "Version: $RPMVERSION" echo "Release: 1%{?dist}" tail --lines=+4 scripts/rh/3proxy.spec.old } > scripts/rh/3proxy.spec @@ -90,5 +105,5 @@ jobs: git config user.name "github-actions[bot]" git config user.email "41898282+github-actions[bot]@users.noreply.github.com" git add debian/changelog scripts/rh/3proxy.spec src/version.h - git commit -m "Update version files for $(tr -d ' \t\r\n' < RELEASE)" + git commit -m "Update version files for $(tr -d ' \t\r\n' < $(test -f RELEASE && echo RELEASE || echo DEVEL))" git push diff --git a/.github/workflows/update-wiki.yml b/.github/workflows/update-wiki.yml index 31f673a..5f2db13 100644 --- a/.github/workflows/update-wiki.yml +++ b/.github/workflows/update-wiki.yml @@ -2,6 +2,7 @@ name: Update wiki on: push: + branches: [master] paths: - 'doc/html/**' workflow_run: @@ -18,6 +19,8 @@ concurrency: jobs: wiki: + # the wiki mirrors master, so a run started by anything else is not for it + if: github.event_name != 'workflow_run' || github.event.workflow_run.head_branch == 'master' runs-on: ubuntu-latest steps: - uses: actions/checkout@v7