From 9ce5de971facb1ee3253649a957e7a6f2051e867 Mon Sep 17 00:00:00 2001 From: Vladimir Dubrovin <3proxy@3proxy.ru> Date: Fri, 23 Oct 2026 20:10:59 +0300 Subject: [PATCH] Release workflows: a minimal set for a release of the development branch A release whose tree has DEVEL and no RELEASE is one of the development branch (release-kind.yml, called by the workflows below). For it only the Windows x64 zip, the x86_64 and arm64 deb packages and the rpm for EL 9 and 10 (x86_64 and arm64) are built and added to the release: no Docker images, no source tarball, no ipk, armhf, watcom, win32 or Windows arm64 builds. docker.yml makes it a prerelease, not "Latest", which also keeps it out of the package repository 3proxy.github.io builds from releases. The packaging reads the version from RELEASE or DEVEL. rpm names the source archive and its directory after the spec's Version, which for 2.0.0-devel is 2.0.0~devel, so that %setup finds it. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/build-ipk.yml | 6 ++++ .github/workflows/build-rpm-arm64.yml | 28 +++++++++++----- .github/workflows/build-rpm-armhf.yml | 6 ++++ .github/workflows/build-rpm-x86-64.yml | 28 +++++++++++----- .github/workflows/build-watcom.yml | 6 ++++ .github/workflows/build-win32.yml | 6 ++++ .github/workflows/build-win64.yml | 4 ++- .github/workflows/build-winarm64.yml | 6 ++++ .github/workflows/docker.yml | 10 ++++++ .github/workflows/release-kind.yml | 46 ++++++++++++++++++++++++++ .github/workflows/release-tarball.yml | 6 ++++ 11 files changed, 135 insertions(+), 17 deletions(-) create mode 100644 .github/workflows/release-kind.yml diff --git a/.github/workflows/build-ipk.yml b/.github/workflows/build-ipk.yml index 5b2173f..b82d733 100644 --- a/.github/workflows/build-ipk.yml +++ b/.github/workflows/build-ipk.yml @@ -12,7 +12,13 @@ env: OPENWRT_RELEASE: 24.10.0 jobs: + kind: + uses: ./.github/workflows/release-kind.yml + ipk: + # not for a release of the development branch + needs: kind + if: github.event_name != 'release' || needs.kind.outputs.devel != 'true' permissions: contents: write id-token: write diff --git a/.github/workflows/build-rpm-arm64.yml b/.github/workflows/build-rpm-arm64.yml index 916a0bd..f6b4495 100644 --- a/.github/workflows/build-rpm-arm64.yml +++ b/.github/workflows/build-rpm-arm64.yml @@ -25,7 +25,19 @@ jobs: - name: env run: | pwd - echo "RELEASE=$(cat RELEASE)" >> $GITHUB_ENV + # a release branch has RELEASE; the development one DEVEL, such as + # 2.0.0-devel, built for fewer EL releases + if [ -f RELEASE ]; then + RELEASE=$(tr -d ' \t\r\n' < RELEASE) + echo "ELS=8 9 10" >> $GITHUB_ENV + else + RELEASE=$(tr -d ' \t\r\n' < DEVEL) + echo "ELS=9 10" >> $GITHUB_ENV + fi + echo "RELEASE=$RELEASE" >> $GITHUB_ENV + # rpm's Version, with a tilde for a hyphen (2.0.0~devel): the source + # archive and its directory are named after it + echo "RPMVERSION=$(sed -n 's/^Version:[[:space:]]*//p' scripts/rh/3proxy.spec)" >> $GITHUB_ENV BUILDDATE=$(sed -n 's/^#define BUILDDATE "\(.*\)"$/\1/p' src/version.h) [ -n "$BUILDDATE" ] || BUILDDATE=$(date -u +%y%m%d%H%M%S) echo "VERSION=$BUILDDATE" >> $GITHUB_ENV @@ -41,19 +53,19 @@ jobs: run: | mkdir ~/debian mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS} - tar -czf ~/rpmbuild/SOURCES/3proxy-$RELEASE.tar.gz --transform "s,^,3proxy-$RELEASE/," . - ln -s ~/rpmbuild/SOURCES/3proxy-$RELEASE.tar.gz ~/rpmbuild/SOURCES/$RELEASE.tar.gz - cp scripts/rh/3proxy.spec ~/rpmbuild/SPECS/3proxy-$RELEASE.spec - cp ~/rpmbuild/SOURCES/3proxy-$RELEASE.tar.gz ~/debian/3proxy_$RELEASE.orig.tar.gz + tar -czf ~/rpmbuild/SOURCES/3proxy-$RPMVERSION.tar.gz --transform "s,^,3proxy-$RPMVERSION/," . + ln -s ~/rpmbuild/SOURCES/3proxy-$RPMVERSION.tar.gz ~/rpmbuild/SOURCES/$RPMVERSION.tar.gz + cp scripts/rh/3proxy.spec ~/rpmbuild/SPECS/3proxy-$RPMVERSION.spec + tar -czf ~/debian/3proxy_$RELEASE.orig.tar.gz --transform "s,^,3proxy-$RELEASE/," . - name: rpmbuild run: | mkdir -p rpmout - for EL in 8 9 10; do + for EL in $ELS; do docker run --rm \ - -v "$HOME/rpmbuild/SOURCES/3proxy-$RELEASE.tar.gz:/src.tar.gz:ro" \ + -v "$HOME/rpmbuild/SOURCES/3proxy-$RPMVERSION.tar.gz:/src.tar.gz:ro" \ -v "$PWD/scripts/rh/3proxy.spec:/3proxy.spec:ro" \ -v "$PWD/rpmout:/out" \ - -e RELEASE="$RELEASE" -e HOSTUID="$(id -u)" -e HOSTGID="$(id -g)" \ + -e RELEASE="$RPMVERSION" -e HOSTUID="$(id -u)" -e HOSTGID="$(id -g)" \ -e SOURCE_DATE_EPOCH="$SOURCE_DATE_EPOCH" \ "almalinux:$EL" bash -c ' set -e diff --git a/.github/workflows/build-rpm-armhf.yml b/.github/workflows/build-rpm-armhf.yml index 0f5bf11..168eb4e 100644 --- a/.github/workflows/build-rpm-armhf.yml +++ b/.github/workflows/build-rpm-armhf.yml @@ -9,7 +9,13 @@ permissions: contents: read jobs: + kind: + uses: ./.github/workflows/release-kind.yml + ci: + # not for a release of the development branch + needs: kind + if: github.event_name != 'release' || needs.kind.outputs.devel != 'true' permissions: contents: write id-token: write diff --git a/.github/workflows/build-rpm-x86-64.yml b/.github/workflows/build-rpm-x86-64.yml index 31df006..01f0707 100644 --- a/.github/workflows/build-rpm-x86-64.yml +++ b/.github/workflows/build-rpm-x86-64.yml @@ -25,7 +25,19 @@ jobs: - name: env run: | pwd - echo "RELEASE=$(cat RELEASE)" >> $GITHUB_ENV + # a release branch has RELEASE; the development one DEVEL, such as + # 2.0.0-devel, built for fewer EL releases + if [ -f RELEASE ]; then + RELEASE=$(tr -d ' \t\r\n' < RELEASE) + echo "ELS=8 9 10" >> $GITHUB_ENV + else + RELEASE=$(tr -d ' \t\r\n' < DEVEL) + echo "ELS=9 10" >> $GITHUB_ENV + fi + echo "RELEASE=$RELEASE" >> $GITHUB_ENV + # rpm's Version, with a tilde for a hyphen (2.0.0~devel): the source + # archive and its directory are named after it + echo "RPMVERSION=$(sed -n 's/^Version:[[:space:]]*//p' scripts/rh/3proxy.spec)" >> $GITHUB_ENV BUILDDATE=$(sed -n 's/^#define BUILDDATE "\(.*\)"$/\1/p' src/version.h) [ -n "$BUILDDATE" ] || BUILDDATE=$(date -u +%y%m%d%H%M%S) echo "VERSION=$BUILDDATE" >> $GITHUB_ENV @@ -41,19 +53,19 @@ jobs: run: | mkdir ~/debian mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS} - tar -czf ~/rpmbuild/SOURCES/3proxy-$RELEASE.tar.gz --transform "s,^,3proxy-$RELEASE/," . - ln -s ~/rpmbuild/SOURCES/3proxy-$RELEASE.tar.gz ~/rpmbuild/SOURCES/$RELEASE.tar.gz - cp scripts/rh/3proxy.spec ~/rpmbuild/SPECS/3proxy-$RELEASE.spec - cp ~/rpmbuild/SOURCES/3proxy-$RELEASE.tar.gz ~/debian/3proxy_$RELEASE.orig.tar.gz + tar -czf ~/rpmbuild/SOURCES/3proxy-$RPMVERSION.tar.gz --transform "s,^,3proxy-$RPMVERSION/," . + ln -s ~/rpmbuild/SOURCES/3proxy-$RPMVERSION.tar.gz ~/rpmbuild/SOURCES/$RPMVERSION.tar.gz + cp scripts/rh/3proxy.spec ~/rpmbuild/SPECS/3proxy-$RPMVERSION.spec + tar -czf ~/debian/3proxy_$RELEASE.orig.tar.gz --transform "s,^,3proxy-$RELEASE/," . - name: rpmbuild run: | mkdir -p rpmout - for EL in 8 9 10; do + for EL in $ELS; do docker run --rm \ - -v "$HOME/rpmbuild/SOURCES/3proxy-$RELEASE.tar.gz:/src.tar.gz:ro" \ + -v "$HOME/rpmbuild/SOURCES/3proxy-$RPMVERSION.tar.gz:/src.tar.gz:ro" \ -v "$PWD/scripts/rh/3proxy.spec:/3proxy.spec:ro" \ -v "$PWD/rpmout:/out" \ - -e RELEASE="$RELEASE" -e HOSTUID="$(id -u)" -e HOSTGID="$(id -g)" \ + -e RELEASE="$RPMVERSION" -e HOSTUID="$(id -u)" -e HOSTGID="$(id -g)" \ -e SOURCE_DATE_EPOCH="$SOURCE_DATE_EPOCH" \ "almalinux:$EL" bash -c ' set -e diff --git a/.github/workflows/build-watcom.yml b/.github/workflows/build-watcom.yml index b0381cd..2ba5013 100644 --- a/.github/workflows/build-watcom.yml +++ b/.github/workflows/build-watcom.yml @@ -9,7 +9,13 @@ permissions: contents: read jobs: + kind: + uses: ./.github/workflows/release-kind.yml + ci: + # not for a release of the development branch + needs: kind + if: github.event_name != 'release' || needs.kind.outputs.devel != 'true' permissions: contents: write id-token: write diff --git a/.github/workflows/build-win32.yml b/.github/workflows/build-win32.yml index 9372a6b..47dded1 100644 --- a/.github/workflows/build-win32.yml +++ b/.github/workflows/build-win32.yml @@ -9,7 +9,13 @@ permissions: contents: read jobs: + kind: + uses: ./.github/workflows/release-kind.yml + ci: + # not for a release of the development branch + needs: kind + if: github.event_name != 'release' || needs.kind.outputs.devel != 'true' permissions: contents: write id-token: write diff --git a/.github/workflows/build-win64.yml b/.github/workflows/build-win64.yml index c4900f5..141180b 100644 --- a/.github/workflows/build-win64.yml +++ b/.github/workflows/build-win64.yml @@ -27,7 +27,9 @@ jobs: - name: set date run: | $NOW = Get-Date -Format "yyMMddHHmmss" - $RELEASE = Get-Content -Path "RELEASE" -Raw + # a release branch has RELEASE, the development one DEVEL + if (Test-Path "RELEASE") { $RELEASE = (Get-Content -Path "RELEASE" -Raw).Trim() } + else { $RELEASE = (Get-Content -Path "DEVEL" -Raw).Trim() } echo "NOW=$NOW" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append echo "RELEASE=$RELEASE" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append echo "VERSION=/D `"VERSION=\`"3proxy-$RELEASE\`"`"" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append diff --git a/.github/workflows/build-winarm64.yml b/.github/workflows/build-winarm64.yml index de910fb..541df84 100644 --- a/.github/workflows/build-winarm64.yml +++ b/.github/workflows/build-winarm64.yml @@ -9,7 +9,13 @@ permissions: contents: read jobs: + kind: + uses: ./.github/workflows/release-kind.yml + ci: + # not for a release of the development branch + needs: kind + if: github.event_name != 'release' || needs.kind.outputs.devel != 'true' permissions: contents: write id-token: write diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index bba4b88..10b68fc 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -13,7 +13,17 @@ env: GHCR_IMAGE: ghcr.io/3proxy/3proxy jobs: + kind: + permissions: + contents: write + uses: ./.github/workflows/release-kind.yml + with: + mark-prerelease: true + build: + # not for a release of the development branch + needs: kind + if: github.event_name != 'release' || needs.kind.outputs.devel != 'true' name: ${{ matrix.image }} ${{ matrix.platform }} permissions: contents: read diff --git a/.github/workflows/release-kind.yml b/.github/workflows/release-kind.yml new file mode 100644 index 0000000..a849fd7 --- /dev/null +++ b/.github/workflows/release-kind.yml @@ -0,0 +1,46 @@ +name: Release kind + +# Whether a release is one of the development branch: its tree has DEVEL +# and no RELEASE. Such a release gets the minimal set of packages (Windows +# x64, deb x86_64 and arm64, rpm for EL 9 and 10), no Docker images, and is +# made a prerelease: neither "Latest" nor taken into the package repository +# of 3proxy.github.io, which takes releases only. + +on: + workflow_call: + inputs: + mark-prerelease: + description: "make a release of the development branch a prerelease" + type: boolean + default: false + outputs: + devel: + description: "true for a release of the development branch" + value: ${{ jobs.kind.outputs.devel }} + +permissions: + contents: read + +jobs: + kind: + runs-on: ubuntu-latest + outputs: + devel: ${{ steps.kind.outputs.devel }} + steps: + - uses: actions/checkout@v7 + with: + sparse-checkout: | + RELEASE + DEVEL + sparse-checkout-cone-mode: false + - id: kind + run: | + if [ ! -f RELEASE ] && [ -f DEVEL ]; then devel=true; else devel=false; fi + echo "devel=$devel" >> "$GITHUB_OUTPUT" + echo "release of the development branch: $devel" + - name: Make it a prerelease + if: inputs.mark-prerelease && github.event_name == 'release' && steps.kind.outputs.devel == 'true' && !github.event.release.prerelease + env: + GH_TOKEN: ${{ github.token }} + TAG: ${{ github.event.release.tag_name }} + run: gh release edit "$TAG" -R "$GITHUB_REPOSITORY" --prerelease --latest=false diff --git a/.github/workflows/release-tarball.yml b/.github/workflows/release-tarball.yml index 1c5154d..5824681 100644 --- a/.github/workflows/release-tarball.yml +++ b/.github/workflows/release-tarball.yml @@ -9,7 +9,13 @@ permissions: contents: read jobs: + kind: + uses: ./.github/workflows/release-kind.yml + tarball: + # not for a release of the development branch + needs: kind + if: github.event_name != 'release' || needs.kind.outputs.devel != 'true' permissions: contents: write id-token: write