Skip to content

Commit 7aa1b48

Browse files
committed
feat: upload files directly to cloudflare
1 parent 3203be2 commit 7aa1b48

File tree

2 files changed

+47
-37
lines changed

2 files changed

+47
-37
lines changed

.github/workflows/main.yml

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -163,13 +163,43 @@ jobs:
163163
with:
164164
name: unraid-web
165165
path: ./plugin/source/dynamix.unraid.net/usr/local/emhttp/plugins/dynamix.my.servers/unraid-components
166+
- name: Download Node.js From Slackbuilds
167+
run: |
168+
# Get latest node version (based on main_node_version) from slackware
169+
main_node_version=$(find "${MAINDIR}/../.." -type f -path "*/api/.nvmrc" -exec sed 's/^v//' {} \;)
170+
base_node_url="https://mirrors.slackware.com/slackware/slackware64-current/slackware64/l/"
171+
latest_nodejs=$(wget -q -O- "${base_node_url}" | grep -o "nodejs-${main_node_version}\.[0-9.]*-x86_64-[0-9]*\.txz" | sort -V | tail -n 1)
172+
if [[ -z "${latest_nodejs}" ]]; then
173+
echo "Error: Failed to fetch the latest nodejs version."
174+
exit 1
175+
fi
176+
node_download_url="${base_node_url}${latest_nodejs}"
177+
if ! wget -q "${node_download_url}" -O "${{ github.workspace }}/plugin/archive/${latest_nodejs}"; then
178+
echo "Error: Failed to download nodejs package."
179+
exit 1
180+
fi
181+
node_sha256=$(sha256sum "${{ github.workspace }}/plugin/archive/${latest_nodejs}" | cut -f 1 -d ' ')
182+
- name: Download nghttp3
183+
run: |
184+
# Get latest nghttp3 version
185+
base_nghttp3_url="https://mirrors.slackware.com/slackware/slackware64-current/slackware64/n/"
186+
latest_nghttp3=$(wget -q -O- "${base_nghttp3_url}" | grep -o "nghttp3-[0-9.]*-x86_64-[0-9]*\.txz" | sort -V | tail -n 1)
187+
nghttp3_download_url="${base_nghttp3_url}${latest_nghttp3}"
188+
if ! wget -q "${nghttp3_download_url}" -O "${{ github.workspace }}/plugin/archive/${latest_nghttp3}"; then
189+
echo "Error: Failed to download nghttp3 package."
190+
exit 1
191+
fi
192+
nghttp3_sha256=$(sha256sum "${{ github.workspace }}/plugin/archive/${latest_nghttp3}" | cut -f 1 -d ' ')
166193
- name: Build Plugin
167194
run: |
168195
cd source/dynamix.unraid.net
169196
export API_VERSION=${{needs.build-test-api.outputs.API_VERSION}}
170197
export API_MD5=${{needs.build-test-api.outputs.API_MD5}}
171198
export API_SHA256=${{needs.build-test-api.outputs.API_SHA256}}
172-
199+
export NODEJS_FILENAME=${latest_nodejs}
200+
export NODEJS_SHA256=${node_sha256}
201+
export NGHTTP3_FILENAME=${latest_nghttp3}
202+
export NGHTTP3_SHA256=${nghttp3_sha256}
173203
bash ./pkg_build.sh s ${{github.event.pull_request.number}}
174204
bash ./pkg_build.sh p
175205
- name: Upload binary txz and plg to Github artifacts
@@ -222,7 +252,7 @@ jobs:
222252
223253
- name: Copy other release files to pr-release
224254
run: |
225-
cp archive/dynamix.unraid.net.staging-*.txz pr-release/
255+
cp archive/*.txz pr-release/
226256
cp plugins/dynamix.unraid.net.staging.plg pr-release/
227257
228258
- name: Upload to Cloudflare
@@ -275,9 +305,9 @@ jobs:
275305
removeMarkdown: false
276306
filePath: "./api/CHANGELOG.md"
277307

278-
- name: Run LS in unraid-api folder
308+
- name: Copy Files for Staging Release
279309
run: |
280-
cp archive/dynamix.unraid.net.staging-*.txz staging-release/
310+
cp archive/*.txz staging-release/
281311
cp plugins/dynamix.unraid.net.staging.plg staging-release/
282312
ls -al staging-release
283313
@@ -331,6 +361,6 @@ jobs:
331361
files: |
332362
unraid-api-*.tgz
333363
plugins/dynamix.unraid.net*
334-
archive/dynamix.unraid.net*
364+
archive/*
335365
env:
336366
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

plugin/source/dynamix.unraid.net/pkg_build.sh

Lines changed: 12 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -51,44 +51,24 @@ cd "${DIR}" || exit 1
5151
PLUGIN_URL="https://stable.dl.unraid.net/unraid-api/\&name;.plg"
5252
MAIN_TXZ="https://stable.dl.unraid.net/unraid-api/${plugin}-${version}.txz"
5353
API_TGZ="https://stable.dl.unraid.net/unraid-api/unraid-api-${API_VERSION}.tgz"
54+
NODE_TGZ="https://stable.dl.unraid.net/unraid-api/${NODEJS_FILENAME}"
55+
NGHTTP3_TGZ="https://stable.dl.unraid.net/unraid-api/${NGHTTP3_FILENAME}"
5456
# Check if PR is set, use a different path if so
5557
if [[ -n "${PR}" ]]; then
5658
MAIN_TXZ="https://preview.dl.unraid.net/unraid-api/pr/${PR}/${plugin}-${version}.txz"
5759
API_TGZ="https://preview.dl.unraid.net/unraid-api/pr/${PR}/unraid-api-${API_VERSION}.tgz"
5860
PLUGIN_URL="https://preview.dl.unraid.net/unraid-api/pr/${PR}/${plugin}.plg"
61+
NODE_TGZ="https://preview.dl.unraid.net/unraid-api/pr/${PR}/${NODEJS_FILENAME}"
62+
NGHTTP3_TGZ="https://preview.dl.unraid.net/unraid-api/pr/${PR}/${NGHTTP3_FILENAME}"
5963
elif [[ "${env}" == "staging" ]]; then
6064
PLUGIN_URL="https://preview.dl.unraid.net/unraid-api/\&name;.plg"
6165
MAIN_TXZ="https://preview.dl.unraid.net/unraid-api/${plugin}-${version}.txz"
6266
API_TGZ="https://preview.dl.unraid.net/unraid-api/unraid-api-${API_VERSION}.tgz"
67+
NODE_TGZ="https://preview.dl.unraid.net/unraid-api/${NODEJS_FILENAME}"
68+
NGHTTP3_TGZ="https://preview.dl.unraid.net/unraid-api/${NGHTTP3_FILENAME}"
6369
fi
6470

65-
# Get latest node version (based on main_node_version) from slackware
66-
main_node_version=$(find "${MAINDIR}/../.." -type f -path "*/api/.nvmrc" -exec sed 's/^v//' {} \;)
67-
base_node_url="https://mirrors.slackware.com/slackware/slackware64-current/slackware64/l/"
68-
latest_nodejs=$(wget -q -O- "${base_node_url}" | grep -o "nodejs-${main_node_version}\.[0-9.]*-x86_64-[0-9]*\.txz" | sort -V | tail -n 1)
69-
if [[ -z "${latest_nodejs}" ]]; then
70-
echo "Error: Failed to fetch the latest nodejs version."
71-
exit 1
72-
fi
73-
node_download_url="${base_node_url}${latest_nodejs}"
74-
if ! wget -q "${node_download_url}" -O "/tmp/${latest_nodejs}"; then
75-
echo "Error: Failed to download nodejs package."
76-
exit 1
77-
fi
78-
node_sha256=$(sha256sum "/tmp/${latest_nodejs}" | cut -f 1 -d ' ')
7971

80-
rm "/tmp/${latest_nodejs}"
81-
82-
# Get latest nghttp3 version
83-
base_nghttp3_url="https://mirrors.slackware.com/slackware/slackware64-current/slackware64/n/"
84-
latest_nghttp3=$(wget -q -O- "${base_nghttp3_url}" | grep -o "nghttp3-[0-9.]*-x86_64-[0-9]*\.txz" | sort -V | tail -n 1)
85-
nghttp3_download_url="${base_nghttp3_url}${latest_nghttp3}"
86-
if ! wget -q "${nghttp3_download_url}" -O "/tmp/${latest_nghttp3}"; then
87-
echo "Error: Failed to download nghttp3 package."
88-
exit 1
89-
fi
90-
nghttp3_sha256=$(sha256sum "/tmp/${latest_nghttp3}" | cut -f 1 -d ' ')
91-
rm "/tmp/${latest_nghttp3}"
9272

9373
# update plg file
9474
sed -i -E "s#(ENTITY name\s*)\".*\"#\1\"${plugin}\"#g" "${plgfile}"
@@ -100,14 +80,14 @@ sed -i -E "s#(ENTITY MAIN_TXZ\s*)\".*\"#\1\"${MAIN_TXZ}\"#g" "${plgfile}"
10080
sed -i -E "s#(ENTITY API_TGZ\s*)\".*\"#\1\"${API_TGZ}\"#g" "${plgfile}"
10181

10282
# update node versions
103-
sed -i -E "s#(ENTITY NODE\s*)\".*\"#\1\"${latest_nodejs}\"#g" "${plgfile}"
104-
sed -i -E "s#(ENTITY NODE_SHA256\s*)\".*\"#\1\"${node_sha256}\"#g" "${plgfile}"
105-
sed -i -E "s#(ENTITY NODE_TXZ\s*)\".*\"#\1\"${node_download_url}\"#g" "${plgfile}"
83+
sed -i -E "s#(ENTITY NODE\s*)\".*\"#\1\"${NODEJS_FILENAME}\"#g" "${plgfile}"
84+
sed -i -E "s#(ENTITY NODE_SHA256\s*)\".*\"#\1\"${NODEJS_SHA256}\"#g" "${plgfile}"
85+
sed -i -E "s#(ENTITY NODE_TXZ\s*)\".*\"#\1\"${NODE_TGZ}\"#g" "${plgfile}"
10686

10787
# update nghttp3 versions
108-
sed -i -E "s#(ENTITY NGHTTP3\s*)\".*\"#\1\"${latest_nghttp3}\"#g" "${plgfile}"
109-
sed -i -E "s#(ENTITY NGHTTP3_SHA256\s*)\".*\"#\1\"${nghttp3_sha256}\"#g" "${plgfile}"
110-
sed -i -E "s#(ENTITY NGHTTP3_TXZ\s*)\".*\"#\1\"${nghttp3_download_url}\"#g" "${plgfile}"
88+
sed -i -E "s#(ENTITY NGHTTP3\s*)\".*\"#\1\"${NGHTTP3_FILENAME}\"#g" "${plgfile}"
89+
sed -i -E "s#(ENTITY NGHTTP3_SHA256\s*)\".*\"#\1\"${NGHTTP3_SHA256}\"#g" "${plgfile}"
90+
sed -i -E "s#(ENTITY NGHTTP3_TXZ\s*)\".*\"#\1\"${NGHTTP3_TGZ}\"#g" "${plgfile}"
11191

11292
# set from environment vars
11393
sed -i -E "s#(ENTITY API_version\s*)\".*\"#\1\"${API_VERSION}\"#g" "${plgfile}"

0 commit comments

Comments
 (0)