Skip to content

Commit 78e688d

Browse files
AghaFarokhAghaFarokh
authored andcommitted
Fix workflow: use GITHUB_TOKEN for xray API, add version fallback, publish release even on partial failures
Made-with: Cursor
1 parent e79346c commit 78e688d

File tree

1 file changed

+37
-6
lines changed

1 file changed

+37
-6
lines changed

.github/workflows/release.yml

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,16 +61,26 @@ jobs:
6161
- name: Get latest xray-core version
6262
id: xray-version
6363
shell: bash
64+
env:
65+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6466
run: |
65-
VERSION=$(curl -s https://api.github.com/repos/XTLS/Xray-core/releases/latest \
67+
VERSION=$(curl -s \
68+
-H "Authorization: token $GITHUB_TOKEN" \
69+
-H "Accept: application/vnd.github.v3+json" \
70+
"https://api.github.com/repos/XTLS/Xray-core/releases/latest" \
6671
| grep '"tag_name"' | head -1 | cut -d'"' -f4)
72+
if [ -z "$VERSION" ]; then
73+
VERSION="v26.2.6"
74+
echo "Warning: Could not fetch latest xray-core version, using fallback $VERSION"
75+
fi
6776
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
6877
echo "xray-core version: $VERSION"
6978
7079
- name: Download xray-core
7180
shell: bash
7281
run: |
7382
URL="https://github.com/XTLS/Xray-core/releases/download/${{ steps.xray-version.outputs.version }}/${{ matrix.xray-asset }}"
83+
echo "Downloading: $URL"
7484
curl -L "$URL" -o xray-pkg.zip
7585
unzip -o xray-pkg.zip "${{ matrix.xray-bin }}" -d dist/
7686
@@ -102,6 +112,8 @@ jobs:
102112
name: Publish Release
103113
needs: build
104114
runs-on: ubuntu-latest
115+
# Run even if some builds failed — publish whatever artifacts were produced
116+
if: ${{ !cancelled() }}
105117
permissions:
106118
contents: write
107119

@@ -124,6 +136,23 @@ jobs:
124136
- name: List artifacts
125137
run: ls -lh artifacts/
126138

139+
- name: Delete existing release if present
140+
shell: bash
141+
env:
142+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
143+
run: |
144+
TAG="${{ steps.tag.outputs.name }}"
145+
RELEASE_ID=$(curl -s \
146+
-H "Authorization: token $GITHUB_TOKEN" \
147+
"https://api.github.com/repos/${{ github.repository }}/releases/tags/$TAG" \
148+
| python3 -c "import sys,json; d=json.load(sys.stdin); print(d.get('id',''))" 2>/dev/null || true)
149+
if [ -n "$RELEASE_ID" ]; then
150+
echo "Deleting existing release $RELEASE_ID for tag $TAG"
151+
curl -s -X DELETE \
152+
-H "Authorization: token $GITHUB_TOKEN" \
153+
"https://api.github.com/repos/${{ github.repository }}/releases/$RELEASE_ID"
154+
fi
155+
127156
- name: Create GitHub Release
128157
uses: softprops/action-gh-release@v2
129158
with:
@@ -141,29 +170,31 @@ jobs:
141170
142171
| File | Platform |
143172
|------|----------|
144-
| `TraceV2ray-windows-x64.zip` | Windows 64-bit |
173+
| `TraceV2ray-windows-x64.zip` | Windows 10/11 (64-bit) |
145174
| `TraceV2ray-macos-arm64.zip` | macOS Apple Silicon (M1/M2/M3) |
146175
| `TraceV2ray-macos-x64.zip` | macOS Intel |
147176
| `TraceV2ray-linux-x64.zip` | Linux 64-bit |
148177
149-
Each zip contains the `TraceV2ray` executable **and** `xray-core` bundled together — no install needed.
178+
Each zip contains the `TraceV2ray` executable and `xray-core` bundled together — no install needed.
150179
151180
---
152181
153182
### Usage
154183
155-
**Windows** — extract zip, then double-click `TraceV2ray.exe` or run:
184+
**Windows** — extract, then double-click `TraceV2ray.exe` or run:
156185
```
157186
TraceV2ray.exe "vless://..."
158187
```
159188
160-
**macOS / Linux** — extract zip, then:
189+
**macOS / Linux** — extract, then:
161190
```bash
191+
chmod +x TraceV2ray xray
162192
./TraceV2ray "vless://..."
163193
```
164194
195+
> macOS users: if blocked by Gatekeeper, run `xattr -dr com.apple.quarantine TraceV2ray xray` first.
196+
165197
The report is saved as `TraceV2ray_Report_YYYYMMDD_HHMMSS.txt` in the current folder.
166-
Send this file for support analysis.
167198
168199
---
169200

0 commit comments

Comments
 (0)