Skip to content

Commit 3bda022

Browse files
xujiegbxujie86
andauthored
Add RiscV64 RPM build && Update (2dust#9114)
* Create package-rhel-riscv.sh * Update build-linux.yml * Update UpdateService.cs * Update CoreInfo.cs * Add RiscV64 download URLs for various platforms * Update build-linux.yml * Update ResUI.fr.resx * Update ResUI.fr.resx * Update ResUI.fr.resx * Update proxy_set_linux_sh --------- Co-authored-by: xujie86 <167618598+xujie86@users.noreply.github.com>
1 parent 2ea9c5a commit 3bda022

7 files changed

Lines changed: 843 additions & 26 deletions

File tree

.github/workflows/build-linux.yml

Lines changed: 76 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
release_tag: ${{ inputs.release_tag }}
2929

3030
deb:
31-
name: build and release deb
31+
name: build and release deb x64 & arm64
3232
if: |
3333
(github.event_name == 'workflow_dispatch' && inputs.release_tag != '') ||
3434
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/'))
@@ -80,7 +80,7 @@ jobs:
8080
prerelease: true
8181

8282
rpm:
83-
name: build and release rpm
83+
name: build and release rpm x64 & arm64
8484
if: |
8585
(github.event_name == 'workflow_dispatch' && inputs.release_tag != '') ||
8686
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/'))
@@ -170,11 +170,84 @@ jobs:
170170
find "$GITHUB_WORKSPACE/dist/rpm" -name "v2rayN-*-1*.aarch64.rpm" -exec mv {} "$GITHUB_WORKSPACE/dist/rpm/v2rayN-linux-rhel-arm64.rpm" \; || true
171171
echo "==== Dist tree ===="
172172
ls -R "$GITHUB_WORKSPACE/dist/rpm" || true
173-
173+
174174
- name: Upload RPMs to release
175175
uses: svenstaro/upload-release-action@v2
176176
with:
177177
file: dist/rpm/**/*.rpm
178178
tag: ${{ env.RELEASE_TAG }}
179179
file_glob: true
180180
prerelease: true
181+
182+
rpm-riscv64:
183+
name: build and release rpm riscv64
184+
if: |
185+
(github.event_name == 'workflow_dispatch' && inputs.release_tag != '') ||
186+
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/'))
187+
runs-on: ubuntu-24.04-riscv
188+
container: ghcr.io/xujiegb/fedora-riscv:43-latest
189+
env:
190+
RELEASE_TAG: ${{ case(inputs.release_tag != '', inputs.release_tag, github.ref_name) }}
191+
192+
steps:
193+
- name: Prepare tools (Red Hat)
194+
shell: bash
195+
run: |
196+
set -euo pipefail
197+
dnf -y makecache
198+
dnf -y install \
199+
sudo git rpm-build rpmdevtools dnf-plugins-core rsync findutils tar gzip unzip which curl jq wget file \
200+
ca-certificates desktop-file-utils xdg-utils python3 gcc make glibc-devel kernel-headers libatomic libstdc++
201+
202+
- name: Checkout repo (for scripts)
203+
shell: bash
204+
env:
205+
GITHUB_TOKEN: ${{ github.token }}
206+
run: |
207+
set -euo pipefail
208+
rm -rf ./*
209+
git init .
210+
git config --global --add safe.directory "$PWD"
211+
git remote add origin "https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
212+
git fetch --depth=1 origin "${GITHUB_SHA}"
213+
git checkout FETCH_HEAD
214+
git submodule update --init --recursive
215+
216+
- name: Ensure script permissions
217+
run: chmod 755 package-rhel-riscv.sh
218+
219+
- name: Package RPM (RHEL-family)
220+
run: ./package-rhel-riscv.sh "${RELEASE_TAG}"
221+
222+
- name: Collect RPMs into workspace
223+
run: |
224+
mkdir -p "$GITHUB_WORKSPACE/dist/rpm-riscv64"
225+
rsync -av "$HOME/rpmbuild/RPMS/" "$GITHUB_WORKSPACE/dist/rpm-riscv64/" || true
226+
find "$GITHUB_WORKSPACE/dist/rpm-riscv64" -name "*.riscv64.rpm" \
227+
-exec mv {} "$GITHUB_WORKSPACE/dist/rpm-riscv64/v2rayN-linux-rhel-riscv64.rpm" \; || true
228+
echo "==== Dist tree ===="
229+
ls -R "$GITHUB_WORKSPACE/dist/rpm-riscv64" || true
230+
231+
- name: Upload RPMs to release
232+
shell: bash
233+
env:
234+
GITHUB_TOKEN: ${{ github.token }}
235+
run: |
236+
set -euo pipefail
237+
shopt -s globstar nullglob
238+
239+
files=(dist/rpm-riscv64/**/*.rpm)
240+
(( ${#files[@]} )) || { echo "No RPMs found."; exit 1; }
241+
242+
api="${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/releases/tags/${RELEASE_TAG}"
243+
upload_url="$(curl -fsSL -H "Authorization: Bearer ${GITHUB_TOKEN}" "$api" | jq -r '.upload_url // empty' | sed 's/{?name,label}//')"
244+
[[ "$upload_url" ]] || { echo "Release upload URL not found: ${RELEASE_TAG}"; exit 1; }
245+
246+
for f in "${files[@]}"; do
247+
echo "Uploading ${f##*/}"
248+
curl -fsSL -X POST \
249+
-H "Authorization: Bearer ${GITHUB_TOKEN}" \
250+
-H "Content-Type: application/x-rpm" \
251+
--data-binary @"$f" \
252+
"${upload_url}?name=${f##*/}"
253+
done

0 commit comments

Comments
 (0)