|
28 | 28 | release_tag: ${{ inputs.release_tag }} |
29 | 29 |
|
30 | 30 | deb: |
31 | | - name: build and release deb |
| 31 | + name: build and release deb x64 & arm64 |
32 | 32 | if: | |
33 | 33 | (github.event_name == 'workflow_dispatch' && inputs.release_tag != '') || |
34 | 34 | (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) |
|
80 | 80 | prerelease: true |
81 | 81 |
|
82 | 82 | rpm: |
83 | | - name: build and release rpm |
| 83 | + name: build and release rpm x64 & arm64 |
84 | 84 | if: | |
85 | 85 | (github.event_name == 'workflow_dispatch' && inputs.release_tag != '') || |
86 | 86 | (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) |
@@ -170,11 +170,84 @@ jobs: |
170 | 170 | find "$GITHUB_WORKSPACE/dist/rpm" -name "v2rayN-*-1*.aarch64.rpm" -exec mv {} "$GITHUB_WORKSPACE/dist/rpm/v2rayN-linux-rhel-arm64.rpm" \; || true |
171 | 171 | echo "==== Dist tree ====" |
172 | 172 | ls -R "$GITHUB_WORKSPACE/dist/rpm" || true |
173 | | - |
| 173 | +
|
174 | 174 | - name: Upload RPMs to release |
175 | 175 | uses: svenstaro/upload-release-action@v2 |
176 | 176 | with: |
177 | 177 | file: dist/rpm/**/*.rpm |
178 | 178 | tag: ${{ env.RELEASE_TAG }} |
179 | 179 | file_glob: true |
180 | 180 | 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