Repository navigation
81 lines (69 loc) · 2.54 KB
/
Copy pathgithub-release-upload.yml
File metadata and controls
81 lines (69 loc) · 2.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
name: GitHub Release Upload
on:
workflow_call:
permissions:
contents: write
jobs:
upload:
name: Upload assets to GitHub draft release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7.0.0
- name: Download builds
uses: actions/download-artifact@v8
with:
name: 'all-builds'
path: release
- name: Read version and find draft release
id: find-release
env:
GH_TOKEN: ${{ github.token }}
run: |
APP_VERSION=$(jq -r '.version' redisinsight/package.json)
echo "version=${APP_VERSION}" >> "$GITHUB_OUTPUT"
RELEASE_TAG=$(gh release list --json tagName,isDraft \
--jq ".[] | select(.isDraft and .tagName == \"${APP_VERSION}\") | .tagName" \
| head -n 1)
if [ -z "$RELEASE_TAG" ]; then
echo "::warning::No draft release found for tag '${APP_VERSION}'. Skipping upload."
echo "found=false" >> "$GITHUB_OUTPUT"
else
echo "Draft release found: ${RELEASE_TAG}"
echo "found=true" >> "$GITHUB_OUTPUT"
echo "tag=${RELEASE_TAG}" >> "$GITHUB_OUTPUT"
fi
- name: Upload desktop installers to draft release
if: steps.find-release.outputs.found == 'true'
env:
GH_TOKEN: ${{ github.token }}
run: |
TAG="${{ steps.find-release.outputs.tag }}"
PATTERNS=(
"Redis-Insight-mac-x64.dmg"
"Redis-Insight-mac-arm64.dmg"
"Redis-Insight-win-installer.exe"
"Redis-Insight-linux-x86_64.AppImage"
"Redis-Insight-linux-arm64.AppImage"
"Redis-Insight-linux-amd64.deb"
"Redis-Insight-linux-arm64.deb"
"Redis-Insight-linux-x86_64.rpm"
"Redis-Insight-linux-aarch64.rpm"
"Redis-Insight-linux-amd64.snap"
)
FILES=()
for pattern in "${PATTERNS[@]}"; do
match=$(find ./release -name "$pattern" -type f 2>/dev/null | head -n 1)
if [ -n "$match" ]; then
FILES+=("$match")
echo "Found: $match"
else
echo "::warning::Installer not found: $pattern"
fi
done
if [ ${#FILES[@]} -eq 0 ]; then
echo "::warning::No desktop installers matched. Nothing to upload."
exit 0
fi
echo "Uploading ${#FILES[@]} file(s) to release '${TAG}'..."
gh release upload "$TAG" "${FILES[@]}" --clobber
echo "Upload complete."