225 lines
7.4 KiB
YAML
225 lines
7.4 KiB
YAML
name: release
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
tag_name:
|
|
description: "Release tag"
|
|
required: true
|
|
target_ref:
|
|
description: "Git ref to release"
|
|
required: false
|
|
default: "master"
|
|
release_name:
|
|
description: "Release name"
|
|
required: false
|
|
default: ""
|
|
release_notes:
|
|
description: "Release notes"
|
|
required: false
|
|
default: ""
|
|
prerelease:
|
|
description: "Mark as prerelease"
|
|
required: false
|
|
default: "false"
|
|
draft:
|
|
description: "Mark as draft"
|
|
required: false
|
|
default: "false"
|
|
|
|
jobs:
|
|
prepare-release:
|
|
name: Prepare release
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
release_id: ${{ steps.release.outputs.release_id }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
ref: ${{ inputs.target_ref }}
|
|
|
|
- name: Ensure release
|
|
id: release
|
|
env:
|
|
GITEA_TOKEN: ${{ secrets.GITEA_PAT }}
|
|
PEYA_GITEA_PAT: ${{ secrets.PEYA_GITEA_PAT }}
|
|
MONERO_C_GITEA_PAT: ${{ secrets.MONERO_C_GITEA_PAT }}
|
|
GITHUB_TOKEN_FALLBACK: ${{ github.token }}
|
|
run: |
|
|
if [ -z "$GITEA_TOKEN" ]; then
|
|
export GITEA_TOKEN="$PEYA_GITEA_PAT"
|
|
fi
|
|
if [ -z "$GITEA_TOKEN" ]; then
|
|
export GITEA_TOKEN="$MONERO_C_GITEA_PAT"
|
|
fi
|
|
if [ -z "$GITEA_TOKEN" ]; then
|
|
export GITEA_TOKEN="$GITHUB_TOKEN_FALLBACK"
|
|
fi
|
|
FLAGS=""
|
|
if [ "${{ inputs.prerelease }}" = "true" ]; then
|
|
FLAGS="$FLAGS --prerelease"
|
|
fi
|
|
if [ "${{ inputs.draft }}" = "true" ]; then
|
|
FLAGS="$FLAGS --draft"
|
|
fi
|
|
python3 scripts/ci/gitea_release.py ensure-release \
|
|
--tag "${{ inputs.tag_name }}" \
|
|
--target "${{ inputs.target_ref }}" \
|
|
--name "${{ inputs.release_name }}" \
|
|
--notes "${{ inputs.release_notes }}" \
|
|
$FLAGS
|
|
|
|
release-linux:
|
|
name: Release Linux
|
|
runs-on: ubuntu-latest
|
|
needs: prepare-release
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
ref: ${{ inputs.target_ref }}
|
|
|
|
- name: Install deps
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y build-essential cmake libuv1-dev
|
|
|
|
- name: Configure
|
|
run: |
|
|
cmake -S . -B build \
|
|
-DCMAKE_BUILD_TYPE=Release \
|
|
-DWITH_TLS=OFF \
|
|
-DWITH_HWLOC=OFF \
|
|
-DWITH_OPENCL=OFF \
|
|
-DWITH_CUDA=OFF \
|
|
-DWITH_NVML=OFF \
|
|
-DWITH_ADL=OFF
|
|
|
|
- name: Build
|
|
run: cmake --build build -j"$(nproc)"
|
|
|
|
- name: Package
|
|
run: |
|
|
mkdir -p dist/linux
|
|
BIN=""
|
|
if [ -x build/xmrig ]; then
|
|
BIN="build/xmrig"
|
|
elif [ -x build/xmrig-notls ]; then
|
|
BIN="build/xmrig-notls"
|
|
else
|
|
echo "No Linux xmrig binary found in build/"
|
|
find build -maxdepth 2 -type f | sort
|
|
exit 1
|
|
fi
|
|
cp "$BIN" dist/linux/xmrig
|
|
cp src/config.json dist/linux/config.json
|
|
cp README.md LICENSE dist/linux/
|
|
tar -C dist/linux -czf "xmrig-peya-${{ inputs.tag_name }}-linux-x86_64.tar.gz" .
|
|
|
|
- name: Upload release asset
|
|
env:
|
|
GITEA_TOKEN: ${{ secrets.GITEA_PAT }}
|
|
PEYA_GITEA_PAT: ${{ secrets.PEYA_GITEA_PAT }}
|
|
MONERO_C_GITEA_PAT: ${{ secrets.MONERO_C_GITEA_PAT }}
|
|
GITHUB_TOKEN_FALLBACK: ${{ github.token }}
|
|
run: |
|
|
if [ -z "$GITEA_TOKEN" ]; then
|
|
export GITEA_TOKEN="$PEYA_GITEA_PAT"
|
|
fi
|
|
if [ -z "$GITEA_TOKEN" ]; then
|
|
export GITEA_TOKEN="$MONERO_C_GITEA_PAT"
|
|
fi
|
|
if [ -z "$GITEA_TOKEN" ]; then
|
|
export GITEA_TOKEN="$GITHUB_TOKEN_FALLBACK"
|
|
fi
|
|
python3 scripts/ci/gitea_release.py upload-asset \
|
|
--release-id "${{ needs.prepare-release.outputs.release_id }}" \
|
|
--file "xmrig-peya-${{ inputs.tag_name }}-linux-x86_64.tar.gz"
|
|
|
|
release-windows:
|
|
name: Release Windows
|
|
runs-on: windows-latest
|
|
needs: prepare-release
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
ref: ${{ inputs.target_ref }}
|
|
|
|
- name: Ensure vcpkg
|
|
shell: cmd
|
|
run: |
|
|
if exist C:\vcpkg (
|
|
echo Using existing vcpkg at C:\vcpkg
|
|
) else (
|
|
git clone https://github.com/microsoft/vcpkg.git C:\vcpkg
|
|
call C:\vcpkg\bootstrap-vcpkg.bat
|
|
)
|
|
C:\vcpkg\vcpkg.exe install libuv:x64-windows-static
|
|
|
|
- name: Resolve CMake
|
|
shell: cmd
|
|
run: |
|
|
set "CMAKE_EXE="
|
|
for %%I in (cmake.exe) do set "CMAKE_EXE=%%~$PATH:I"
|
|
if not defined CMAKE_EXE if exist "C:\Program Files\CMake\bin\cmake.exe" set "CMAKE_EXE=C:\Program Files\CMake\bin\cmake.exe"
|
|
if not defined CMAKE_EXE if exist "C:\Program Files (x86)\CMake\bin\cmake.exe" set "CMAKE_EXE=C:\Program Files (x86)\CMake\bin\cmake.exe"
|
|
if not defined CMAKE_EXE (
|
|
echo CMake not found on runner PATH or standard install locations.
|
|
exit /b 1
|
|
)
|
|
echo Using CMake: %CMAKE_EXE%
|
|
echo CMAKE_EXE=%CMAKE_EXE%>>%GITHUB_ENV%
|
|
|
|
- name: Configure
|
|
shell: cmd
|
|
run: |
|
|
"%CMAKE_EXE%" -S . -B build -A x64 ^
|
|
-DCMAKE_BUILD_TYPE=Release ^
|
|
-DCMAKE_TOOLCHAIN_FILE=C:\vcpkg\scripts\buildsystems\vcpkg.cmake ^
|
|
-DVCPKG_TARGET_TRIPLET=x64-windows-static ^
|
|
-DWITH_TLS=OFF ^
|
|
-DWITH_HWLOC=OFF ^
|
|
-DWITH_OPENCL=OFF ^
|
|
-DWITH_CUDA=OFF ^
|
|
-DWITH_NVML=OFF ^
|
|
-DWITH_ADL=OFF
|
|
|
|
- name: Build
|
|
shell: cmd
|
|
run: '"%CMAKE_EXE%" --build build --config Release'
|
|
|
|
- name: Package
|
|
shell: cmd
|
|
run: |
|
|
if not exist dist\windows mkdir dist\windows
|
|
set BIN_PATH=
|
|
if exist build\Release\xmrig.exe set BIN_PATH=build\Release\xmrig.exe
|
|
if not defined BIN_PATH if exist build\Release\xmrig-notls.exe set BIN_PATH=build\Release\xmrig-notls.exe
|
|
if not defined BIN_PATH (
|
|
echo Could not find xmrig.exe or xmrig-notls.exe in build\Release
|
|
dir build\Release
|
|
exit /b 1
|
|
)
|
|
copy %BIN_PATH% dist\windows\xmrig.exe
|
|
copy src\config.json dist\windows\config.json
|
|
copy README.md dist\windows\
|
|
copy LICENSE dist\windows\
|
|
powershell -NoProfile -Command "Compress-Archive -Path dist\\windows\\* -DestinationPath xmrig-peya-${{ inputs.tag_name }}-windows-x86_64.zip -Force"
|
|
|
|
- name: Upload release asset
|
|
shell: cmd
|
|
env:
|
|
GITEA_TOKEN: ${{ secrets.GITEA_PAT }}
|
|
PEYA_GITEA_PAT: ${{ secrets.PEYA_GITEA_PAT }}
|
|
MONERO_C_GITEA_PAT: ${{ secrets.MONERO_C_GITEA_PAT }}
|
|
GITHUB_TOKEN_FALLBACK: ${{ github.token }}
|
|
run: |
|
|
if "%GITEA_TOKEN%"=="" set GITEA_TOKEN=%PEYA_GITEA_PAT%
|
|
if "%GITEA_TOKEN%"=="" set GITEA_TOKEN=%MONERO_C_GITEA_PAT%
|
|
if "%GITEA_TOKEN%"=="" set GITEA_TOKEN=%GITHUB_TOKEN_FALLBACK%
|
|
python scripts/ci/gitea_release.py upload-asset ^
|
|
--release-id "${{ needs.prepare-release.outputs.release_id }}" ^
|
|
--file "xmrig-peya-${{ inputs.tag_name }}-windows-x86_64.zip"
|