From 997671ee16ecb71c6d8ec10cc0b899e8eaca2dd9 Mon Sep 17 00:00:00 2001 From: Vladimir Dubrovin <3proxy@3proxy.ru> Date: Sun, 31 May 2026 15:29:11 +0300 Subject: [PATCH] publish builds on release --- .github/workflows/build-rpm-arm64.yml | 19 +++++++++++++++---- .github/workflows/build-rpm-armhf.yml | 19 +++++++++++++++---- .github/workflows/build-rpm-x86-64.yml | 17 ++++++++++++++--- .github/workflows/build-watcom.yml | 15 ++++++++++++--- .github/workflows/build-win32.yml | 15 ++++++++++++--- .github/workflows/build-win64.yml | 15 ++++++++++++--- .github/workflows/build-winarm64.yml | 15 ++++++++++++--- .github/workflows/docker-ghcr.yml | 22 +++++++++------------- .github/workflows/docker.yml | 22 +++++++++------------- 9 files changed, 110 insertions(+), 49 deletions(-) diff --git a/.github/workflows/build-rpm-arm64.yml b/.github/workflows/build-rpm-arm64.yml index f085c8b..6ee2ca3 100644 --- a/.github/workflows/build-rpm-arm64.yml +++ b/.github/workflows/build-rpm-arm64.yml @@ -1,9 +1,8 @@ name: RPM/DEB build aarch64 on: - push: - paths: - - 'RELEASE' + release: + types: [published] workflow_dispatch: jobs: @@ -45,11 +44,17 @@ jobs: rpmbuild -ba 3proxy-$RELEASE.spec cd $ret mv ~/rpmbuild/RPMS/aarch64/3proxy-$RELEASE-1.aarch64.rpm 3proxy-$RELEASE.arm64.rpm - - name: Get artifact arp + - name: Get artifact rpm uses: actions/upload-artifact@v6 with: name: "3proxy-${{ env.RELEASE }}-arm64.rpm" path: "*.rpm" + - name: Upload rpm to release + if: github.event_name == 'release' + env: + GH_TOKEN: ${{ github.token }} + TAG: ${{ github.event.release.tag_name }} + run: gh release upload "$TAG" 3proxy-${{ env.RELEASE }}.arm64.rpm - name: debbuild run: | ret=`pwd` @@ -70,3 +75,9 @@ jobs: with: name: "3proxy-${{ env.RELEASE }}-arm64.deb" path: "*.deb" + - name: Upload deb to release + if: github.event_name == 'release' + env: + GH_TOKEN: ${{ github.token }} + TAG: ${{ github.event.release.tag_name }} + run: gh release upload "$TAG" 3proxy-${{ env.RELEASE }}.arm64.deb diff --git a/.github/workflows/build-rpm-armhf.yml b/.github/workflows/build-rpm-armhf.yml index 4afff3c..e3e05ea 100644 --- a/.github/workflows/build-rpm-armhf.yml +++ b/.github/workflows/build-rpm-armhf.yml @@ -1,9 +1,8 @@ name: RPM/DEB build armhf on: - push: - paths: - - 'RELEASE' + release: + types: [published] workflow_dispatch: jobs: @@ -72,11 +71,17 @@ jobs: rpmbuild -ba --define "PAMLIB pam0g" --define "_arch arm" --define "cross yes" --target=arm-linux-gnueabi 3proxy-$RELEASE.spec cd $ret mv ~/rpmbuild/RPMS/arm/3proxy-$RELEASE-1.arm.rpm 3proxy-$RELEASE.arm.rpm - - name: Get artifact + - name: Get artifact rpm uses: actions/upload-artifact@v6 with: name: "3proxy-${{ env.RELEASE }}-arm.rpm" path: "*.rpm" + - name: Upload rpm to release + if: github.event_name == 'release' + env: + GH_TOKEN: ${{ github.token }} + TAG: ${{ github.event.release.tag_name }} + run: gh release upload "$TAG" 3proxy-${{ env.RELEASE }}.arm.rpm - name: debbuild run: | ret=`pwd` @@ -103,3 +108,9 @@ jobs: with: name: "3proxy-${{ env.RELEASE }}-arm.deb" path: "*.deb" + - name: Upload deb to release + if: github.event_name == 'release' + env: + GH_TOKEN: ${{ github.token }} + TAG: ${{ github.event.release.tag_name }} + run: gh release upload "$TAG" 3proxy-${{ env.RELEASE }}.arm.deb diff --git a/.github/workflows/build-rpm-x86-64.yml b/.github/workflows/build-rpm-x86-64.yml index 9d9cf4d..11a6442 100644 --- a/.github/workflows/build-rpm-x86-64.yml +++ b/.github/workflows/build-rpm-x86-64.yml @@ -1,9 +1,8 @@ name: RPM/DEB build x86-64 on: - push: - paths: - - 'RELEASE' + release: + types: [published] workflow_dispatch: jobs: @@ -50,6 +49,12 @@ jobs: with: name: "3proxy-${{ env.RELEASE }}-x86_64.rpm" path: "*.rpm" + - name: Upload rpm to release + if: github.event_name == 'release' + env: + GH_TOKEN: ${{ github.token }} + TAG: ${{ github.event.release.tag_name }} + run: gh release upload "$TAG" 3proxy-${{ env.RELEASE }}.x86_64.rpm - name: debbuild run: | ret=`pwd` @@ -70,4 +75,10 @@ jobs: with: name: "3proxy-${{ env.RELEASE }}-x86_64.deb" path: "*.deb" + - name: Upload deb to release + if: github.event_name == 'release' + env: + GH_TOKEN: ${{ github.token }} + TAG: ${{ github.event.release.tag_name }} + run: gh release upload "$TAG" 3proxy-${{ env.RELEASE }}.x86_64.deb diff --git a/.github/workflows/build-watcom.yml b/.github/workflows/build-watcom.yml index d6caf0f..73541fe 100644 --- a/.github/workflows/build-watcom.yml +++ b/.github/workflows/build-watcom.yml @@ -1,9 +1,8 @@ name: Build Win32 3proxy-lite with Watcom on: - push: - paths: - - 'RELEASE' + release: + types: [published] workflow_dispatch: jobs: @@ -80,3 +79,13 @@ jobs: with: name: "3proxy-${{ env.RELEASE }}-lite" path: dist/ + - name: Create zip + if: github.event_name == 'release' + shell: pwsh + run: Compress-Archive -Path dist/* -DestinationPath 3proxy-${{ env.RELEASE }}-lite.zip + - name: Upload to release + if: github.event_name == 'release' + env: + GH_TOKEN: ${{ github.token }} + TAG: ${{ github.event.release.tag_name }} + run: gh release upload "$TAG" 3proxy-${{ env.RELEASE }}-lite.zip diff --git a/.github/workflows/build-win32.yml b/.github/workflows/build-win32.yml index 34107f2..e7b14c3 100644 --- a/.github/workflows/build-win32.yml +++ b/.github/workflows/build-win32.yml @@ -1,9 +1,8 @@ name: Build Win32 3proxy with MSVC on: - push: - paths: - - 'RELEASE' + release: + types: [published] workflow_dispatch: jobs: @@ -86,3 +85,13 @@ jobs: with: name: "3proxy-${{ env.RELEASE }}" path: dist/ + - name: Create zip + if: github.event_name == 'release' + shell: pwsh + run: Compress-Archive -Path dist/* -DestinationPath 3proxy-${{ env.RELEASE }}-x86.zip + - name: Upload to release + if: github.event_name == 'release' + env: + GH_TOKEN: ${{ github.token }} + TAG: ${{ github.event.release.tag_name }} + run: gh release upload "$TAG" 3proxy-${{ env.RELEASE }}-x86.zip diff --git a/.github/workflows/build-win64.yml b/.github/workflows/build-win64.yml index ca38ba6..c6ab8ce 100644 --- a/.github/workflows/build-win64.yml +++ b/.github/workflows/build-win64.yml @@ -1,9 +1,8 @@ name: Build Win64 3proxy with MSVC on: - push: - paths: - - 'RELEASE' + release: + types: [published] workflow_dispatch: jobs: @@ -87,3 +86,13 @@ jobs: with: name: "3proxy-${{ env.RELEASE }}-x64" path: dist/ + - name: Create zip + if: github.event_name == 'release' + shell: pwsh + run: Compress-Archive -Path dist/* -DestinationPath 3proxy-${{ env.RELEASE }}-x64.zip + - name: Upload to release + if: github.event_name == 'release' + env: + GH_TOKEN: ${{ github.token }} + TAG: ${{ github.event.release.tag_name }} + run: gh release upload "$TAG" 3proxy-${{ env.RELEASE }}-x64.zip diff --git a/.github/workflows/build-winarm64.yml b/.github/workflows/build-winarm64.yml index 9abf7ba..9e8198c 100644 --- a/.github/workflows/build-winarm64.yml +++ b/.github/workflows/build-winarm64.yml @@ -1,9 +1,8 @@ name: Build Win-arm64 3proxy with MSVC on: - push: - paths: - - 'RELEASE' + release: + types: [published] workflow_dispatch: jobs: @@ -86,3 +85,13 @@ jobs: with: name: "3proxy-${{ env.RELEASE }}-arm64" path: dist/ + - name: Create zip + if: github.event_name == 'release' + shell: pwsh + run: Compress-Archive -Path dist/* -DestinationPath 3proxy-${{ env.RELEASE }}-arm64.zip + - name: Upload to release + if: github.event_name == 'release' + env: + GH_TOKEN: ${{ github.token }} + TAG: ${{ github.event.release.tag_name }} + run: gh release upload "$TAG" 3proxy-${{ env.RELEASE }}-arm64.zip diff --git a/.github/workflows/docker-ghcr.yml b/.github/workflows/docker-ghcr.yml index adbb88c..7622b14 100644 --- a/.github/workflows/docker-ghcr.yml +++ b/.github/workflows/docker-ghcr.yml @@ -1,10 +1,8 @@ name: Build Docker images (GHCR) on: - push: - branches: [master] - paths: - - 'RELEASE' + release: + types: [published] workflow_dispatch: env: @@ -25,19 +23,20 @@ jobs: - name: Determine tags id: tags env: - REF: ${{ github.ref }} + RELEASE_TAG: ${{ github.event.release.tag_name }} IMAGE: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} run: | - if [[ "$REF" == refs/tags/* ]]; then - RELEASE=$(cat RELEASE) + if [[ "$RELEASE_TAG" != "" ]]; then + RELEASE="${RELEASE_TAG#v}" echo "minimal=${IMAGE}:${RELEASE}.minimal,${IMAGE}:minimal" >> "$GITHUB_OUTPUT" echo "busybox=${IMAGE}:${RELEASE}.busybox,${IMAGE}:busybox" >> "$GITHUB_OUTPUT" echo "full=${IMAGE}:${RELEASE},${IMAGE}:latest" >> "$GITHUB_OUTPUT" else DATETIME=$(date +%d%m%y%H%M%S) - echo "minimal=${IMAGE}:${DATETIME}-devel.minimal,${IMAGE}:devel.minimal" >> "$GITHUB_OUTPUT" - echo "busybox=${IMAGE}:${DATETIME}-devel.busybox,${IMAGE}:devel.busybox" >> "$GITHUB_OUTPUT" - echo "full=${IMAGE}:${DATETIME}-devel,${IMAGE}:devel" >> "$GITHUB_OUTPUT" + BRANCH=$(echo "${GITHUB_REF#refs/heads/}" | tr "/" "-") + echo "minimal=${IMAGE}:${DATETIME}-${BRANCH}.minimal,${IMAGE}:${BRANCH}.minimal" >> "$GITHUB_OUTPUT" + echo "busybox=${IMAGE}:${DATETIME}-${BRANCH}.busybox,${IMAGE}:${BRANCH}.busybox" >> "$GITHUB_OUTPUT" + echo "full=${IMAGE}:${DATETIME}-${BRANCH},${IMAGE}:${BRANCH}" >> "$GITHUB_OUTPUT" fi - name: Set up QEMU @@ -61,7 +60,6 @@ jobs: file: Dockerfile.minimal platforms: linux/amd64,linux/arm64 push: ${{ github.event_name != 'pull_request' }} - no-cache: true tags: ${{ steps.tags.outputs.minimal }} - name: Build and push busybox @@ -71,7 +69,6 @@ jobs: file: Dockerfile.busybox platforms: linux/amd64,linux/arm64 push: ${{ github.event_name != 'pull_request' }} - no-cache: true tags: ${{ steps.tags.outputs.busybox }} - name: Build and push full @@ -81,7 +78,6 @@ jobs: file: Dockerfile.full platforms: linux/amd64,linux/arm64 push: ${{ github.event_name != 'pull_request' }} - no-cache: true tags: ${{ steps.tags.outputs.full }} - name: Delete untagged GHCR images diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 0d6155a..df1ac87 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -1,10 +1,8 @@ name: Build Docker images (Docker Hub) on: - push: - branches: [master] - paths: - - 'RELEASE' + release: + types: [published] workflow_dispatch: env: @@ -24,18 +22,19 @@ jobs: - name: Determine tags id: tags env: - REF: ${{ github.ref }} + RELEASE_TAG: ${{ github.event.release.tag_name }} run: | - if [[ "$REF" == refs/tags/* ]]; then - RELEASE=$(cat RELEASE) + if [[ "$RELEASE_TAG" != "" ]]; then + RELEASE="${RELEASE_TAG#v}" echo "minimal=${REGISTRY}/${IMAGE_NAME}:${RELEASE}.minimal,${REGISTRY}/${IMAGE_NAME}:minimal" >> "$GITHUB_OUTPUT" echo "busybox=${REGISTRY}/${IMAGE_NAME}:${RELEASE}.busybox,${REGISTRY}/${IMAGE_NAME}:busybox" >> "$GITHUB_OUTPUT" echo "full=${REGISTRY}/${IMAGE_NAME}:${RELEASE},${REGISTRY}/${IMAGE_NAME}:latest" >> "$GITHUB_OUTPUT" else DATETIME=$(date +%d%m%y%H%M%S) - echo "minimal=${REGISTRY}/${IMAGE_NAME}:${DATETIME}-devel.minimal,${REGISTRY}/${IMAGE_NAME}:devel.minimal" >> "$GITHUB_OUTPUT" - echo "busybox=${REGISTRY}/${IMAGE_NAME}:${DATETIME}-devel.busybox,${REGISTRY}/${IMAGE_NAME}:devel.busybox" >> "$GITHUB_OUTPUT" - echo "full=${REGISTRY}/${IMAGE_NAME}:${DATETIME}-devel,${REGISTRY}/${IMAGE_NAME}:devel" >> "$GITHUB_OUTPUT" + BRANCH=$(echo "${GITHUB_REF#refs/heads/}" | tr "/" "-") + echo "minimal=${REGISTRY}/${IMAGE_NAME}:${DATETIME}-${BRANCH}.minimal,${REGISTRY}/${IMAGE_NAME}:${BRANCH}.minimal" >> "$GITHUB_OUTPUT" + echo "busybox=${REGISTRY}/${IMAGE_NAME}:${DATETIME}-${BRANCH}.busybox,${REGISTRY}/${IMAGE_NAME}:${BRANCH}.busybox" >> "$GITHUB_OUTPUT" + echo "full=${REGISTRY}/${IMAGE_NAME}:${DATETIME}-${BRANCH},${REGISTRY}/${IMAGE_NAME}:${BRANCH}" >> "$GITHUB_OUTPUT" fi - name: Set up QEMU @@ -58,7 +57,6 @@ jobs: file: Dockerfile.minimal platforms: linux/amd64,linux/arm64 push: ${{ github.event_name != 'pull_request' }} - no-cache: true tags: ${{ steps.tags.outputs.minimal }} - name: Build and push busybox @@ -68,7 +66,6 @@ jobs: file: Dockerfile.busybox platforms: linux/amd64,linux/arm64 push: ${{ github.event_name != 'pull_request' }} - no-cache: true tags: ${{ steps.tags.outputs.busybox }} - name: Build and push full @@ -78,5 +75,4 @@ jobs: file: Dockerfile.full platforms: linux/amd64,linux/arm64 push: ${{ github.event_name != 'pull_request' }} - no-cache: true tags: ${{ steps.tags.outputs.full }}