mirror of
https://github.com/unraid/api.git
synced 2025-12-31 13:39:52 -06:00
feat: upload files directly to cloudflare
This commit is contained in:
40
.github/workflows/main.yml
vendored
40
.github/workflows/main.yml
vendored
@@ -163,13 +163,43 @@ jobs:
|
||||
with:
|
||||
name: unraid-web
|
||||
path: ./plugin/source/dynamix.unraid.net/usr/local/emhttp/plugins/dynamix.my.servers/unraid-components
|
||||
- name: Download Node.js From Slackbuilds
|
||||
run: |
|
||||
# Get latest node version (based on main_node_version) from slackware
|
||||
main_node_version=$(find "${MAINDIR}/../.." -type f -path "*/api/.nvmrc" -exec sed 's/^v//' {} \;)
|
||||
base_node_url="https://mirrors.slackware.com/slackware/slackware64-current/slackware64/l/"
|
||||
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)
|
||||
if [[ -z "${latest_nodejs}" ]]; then
|
||||
echo "Error: Failed to fetch the latest nodejs version."
|
||||
exit 1
|
||||
fi
|
||||
node_download_url="${base_node_url}${latest_nodejs}"
|
||||
if ! wget -q "${node_download_url}" -O "${{ github.workspace }}/plugin/archive/${latest_nodejs}"; then
|
||||
echo "Error: Failed to download nodejs package."
|
||||
exit 1
|
||||
fi
|
||||
node_sha256=$(sha256sum "${{ github.workspace }}/plugin/archive/${latest_nodejs}" | cut -f 1 -d ' ')
|
||||
- name: Download nghttp3
|
||||
run: |
|
||||
# Get latest nghttp3 version
|
||||
base_nghttp3_url="https://mirrors.slackware.com/slackware/slackware64-current/slackware64/n/"
|
||||
latest_nghttp3=$(wget -q -O- "${base_nghttp3_url}" | grep -o "nghttp3-[0-9.]*-x86_64-[0-9]*\.txz" | sort -V | tail -n 1)
|
||||
nghttp3_download_url="${base_nghttp3_url}${latest_nghttp3}"
|
||||
if ! wget -q "${nghttp3_download_url}" -O "${{ github.workspace }}/plugin/archive/${latest_nghttp3}"; then
|
||||
echo "Error: Failed to download nghttp3 package."
|
||||
exit 1
|
||||
fi
|
||||
nghttp3_sha256=$(sha256sum "${{ github.workspace }}/plugin/archive/${latest_nghttp3}" | cut -f 1 -d ' ')
|
||||
- name: Build Plugin
|
||||
run: |
|
||||
cd source/dynamix.unraid.net
|
||||
export API_VERSION=${{needs.build-test-api.outputs.API_VERSION}}
|
||||
export API_MD5=${{needs.build-test-api.outputs.API_MD5}}
|
||||
export API_SHA256=${{needs.build-test-api.outputs.API_SHA256}}
|
||||
|
||||
export NODEJS_FILENAME=${latest_nodejs}
|
||||
export NODEJS_SHA256=${node_sha256}
|
||||
export NGHTTP3_FILENAME=${latest_nghttp3}
|
||||
export NGHTTP3_SHA256=${nghttp3_sha256}
|
||||
bash ./pkg_build.sh s ${{github.event.pull_request.number}}
|
||||
bash ./pkg_build.sh p
|
||||
- name: Upload binary txz and plg to Github artifacts
|
||||
@@ -222,7 +252,7 @@ jobs:
|
||||
|
||||
- name: Copy other release files to pr-release
|
||||
run: |
|
||||
cp archive/dynamix.unraid.net.staging-*.txz pr-release/
|
||||
cp archive/*.txz pr-release/
|
||||
cp plugins/dynamix.unraid.net.staging.plg pr-release/
|
||||
|
||||
- name: Upload to Cloudflare
|
||||
@@ -275,9 +305,9 @@ jobs:
|
||||
removeMarkdown: false
|
||||
filePath: "./api/CHANGELOG.md"
|
||||
|
||||
- name: Run LS in unraid-api folder
|
||||
- name: Copy Files for Staging Release
|
||||
run: |
|
||||
cp archive/dynamix.unraid.net.staging-*.txz staging-release/
|
||||
cp archive/*.txz staging-release/
|
||||
cp plugins/dynamix.unraid.net.staging.plg staging-release/
|
||||
ls -al staging-release
|
||||
|
||||
@@ -331,6 +361,6 @@ jobs:
|
||||
files: |
|
||||
unraid-api-*.tgz
|
||||
plugins/dynamix.unraid.net*
|
||||
archive/dynamix.unraid.net*
|
||||
archive/*
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
@@ -51,44 +51,24 @@ cd "${DIR}" || exit 1
|
||||
PLUGIN_URL="https://stable.dl.unraid.net/unraid-api/\&name;.plg"
|
||||
MAIN_TXZ="https://stable.dl.unraid.net/unraid-api/${plugin}-${version}.txz"
|
||||
API_TGZ="https://stable.dl.unraid.net/unraid-api/unraid-api-${API_VERSION}.tgz"
|
||||
NODE_TGZ="https://stable.dl.unraid.net/unraid-api/${NODEJS_FILENAME}"
|
||||
NGHTTP3_TGZ="https://stable.dl.unraid.net/unraid-api/${NGHTTP3_FILENAME}"
|
||||
# Check if PR is set, use a different path if so
|
||||
if [[ -n "${PR}" ]]; then
|
||||
MAIN_TXZ="https://preview.dl.unraid.net/unraid-api/pr/${PR}/${plugin}-${version}.txz"
|
||||
API_TGZ="https://preview.dl.unraid.net/unraid-api/pr/${PR}/unraid-api-${API_VERSION}.tgz"
|
||||
PLUGIN_URL="https://preview.dl.unraid.net/unraid-api/pr/${PR}/${plugin}.plg"
|
||||
NODE_TGZ="https://preview.dl.unraid.net/unraid-api/pr/${PR}/${NODEJS_FILENAME}"
|
||||
NGHTTP3_TGZ="https://preview.dl.unraid.net/unraid-api/pr/${PR}/${NGHTTP3_FILENAME}"
|
||||
elif [[ "${env}" == "staging" ]]; then
|
||||
PLUGIN_URL="https://preview.dl.unraid.net/unraid-api/\&name;.plg"
|
||||
MAIN_TXZ="https://preview.dl.unraid.net/unraid-api/${plugin}-${version}.txz"
|
||||
API_TGZ="https://preview.dl.unraid.net/unraid-api/unraid-api-${API_VERSION}.tgz"
|
||||
NODE_TGZ="https://preview.dl.unraid.net/unraid-api/${NODEJS_FILENAME}"
|
||||
NGHTTP3_TGZ="https://preview.dl.unraid.net/unraid-api/${NGHTTP3_FILENAME}"
|
||||
fi
|
||||
|
||||
# Get latest node version (based on main_node_version) from slackware
|
||||
main_node_version=$(find "${MAINDIR}/../.." -type f -path "*/api/.nvmrc" -exec sed 's/^v//' {} \;)
|
||||
base_node_url="https://mirrors.slackware.com/slackware/slackware64-current/slackware64/l/"
|
||||
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)
|
||||
if [[ -z "${latest_nodejs}" ]]; then
|
||||
echo "Error: Failed to fetch the latest nodejs version."
|
||||
exit 1
|
||||
fi
|
||||
node_download_url="${base_node_url}${latest_nodejs}"
|
||||
if ! wget -q "${node_download_url}" -O "/tmp/${latest_nodejs}"; then
|
||||
echo "Error: Failed to download nodejs package."
|
||||
exit 1
|
||||
fi
|
||||
node_sha256=$(sha256sum "/tmp/${latest_nodejs}" | cut -f 1 -d ' ')
|
||||
|
||||
rm "/tmp/${latest_nodejs}"
|
||||
|
||||
# Get latest nghttp3 version
|
||||
base_nghttp3_url="https://mirrors.slackware.com/slackware/slackware64-current/slackware64/n/"
|
||||
latest_nghttp3=$(wget -q -O- "${base_nghttp3_url}" | grep -o "nghttp3-[0-9.]*-x86_64-[0-9]*\.txz" | sort -V | tail -n 1)
|
||||
nghttp3_download_url="${base_nghttp3_url}${latest_nghttp3}"
|
||||
if ! wget -q "${nghttp3_download_url}" -O "/tmp/${latest_nghttp3}"; then
|
||||
echo "Error: Failed to download nghttp3 package."
|
||||
exit 1
|
||||
fi
|
||||
nghttp3_sha256=$(sha256sum "/tmp/${latest_nghttp3}" | cut -f 1 -d ' ')
|
||||
rm "/tmp/${latest_nghttp3}"
|
||||
|
||||
# update plg file
|
||||
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}"
|
||||
sed -i -E "s#(ENTITY API_TGZ\s*)\".*\"#\1\"${API_TGZ}\"#g" "${plgfile}"
|
||||
|
||||
# update node versions
|
||||
sed -i -E "s#(ENTITY NODE\s*)\".*\"#\1\"${latest_nodejs}\"#g" "${plgfile}"
|
||||
sed -i -E "s#(ENTITY NODE_SHA256\s*)\".*\"#\1\"${node_sha256}\"#g" "${plgfile}"
|
||||
sed -i -E "s#(ENTITY NODE_TXZ\s*)\".*\"#\1\"${node_download_url}\"#g" "${plgfile}"
|
||||
sed -i -E "s#(ENTITY NODE\s*)\".*\"#\1\"${NODEJS_FILENAME}\"#g" "${plgfile}"
|
||||
sed -i -E "s#(ENTITY NODE_SHA256\s*)\".*\"#\1\"${NODEJS_SHA256}\"#g" "${plgfile}"
|
||||
sed -i -E "s#(ENTITY NODE_TXZ\s*)\".*\"#\1\"${NODE_TGZ}\"#g" "${plgfile}"
|
||||
|
||||
# update nghttp3 versions
|
||||
sed -i -E "s#(ENTITY NGHTTP3\s*)\".*\"#\1\"${latest_nghttp3}\"#g" "${plgfile}"
|
||||
sed -i -E "s#(ENTITY NGHTTP3_SHA256\s*)\".*\"#\1\"${nghttp3_sha256}\"#g" "${plgfile}"
|
||||
sed -i -E "s#(ENTITY NGHTTP3_TXZ\s*)\".*\"#\1\"${nghttp3_download_url}\"#g" "${plgfile}"
|
||||
sed -i -E "s#(ENTITY NGHTTP3\s*)\".*\"#\1\"${NGHTTP3_FILENAME}\"#g" "${plgfile}"
|
||||
sed -i -E "s#(ENTITY NGHTTP3_SHA256\s*)\".*\"#\1\"${NGHTTP3_SHA256}\"#g" "${plgfile}"
|
||||
sed -i -E "s#(ENTITY NGHTTP3_TXZ\s*)\".*\"#\1\"${NGHTTP3_TGZ}\"#g" "${plgfile}"
|
||||
|
||||
# set from environment vars
|
||||
sed -i -E "s#(ENTITY API_version\s*)\".*\"#\1\"${API_VERSION}\"#g" "${plgfile}"
|
||||
|
||||
Reference in New Issue
Block a user