mirror of
https://github.com/unraid/api.git
synced 2026-02-21 15:38:44 -06:00
feat: plg builder improvements to be more explicit
This commit is contained in:
5
.github/workflows/main.yml
vendored
5
.github/workflows/main.yml
vendored
@@ -174,7 +174,6 @@ jobs:
|
||||
release-pull-request:
|
||||
if: |
|
||||
github.event_name == 'pull_request' &&
|
||||
github.event.action == 'opened' &&
|
||||
github.event.pull_request.base.ref == 'main'
|
||||
runs-on: ubuntu-latest
|
||||
needs: [build-plugin]
|
||||
@@ -204,11 +203,11 @@ jobs:
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.CF_SECRET_ACCESS_KEY }}
|
||||
AWS_REGION: "auto"
|
||||
SOURCE_DIR: pr-release
|
||||
DEST_DIR: unraid-api/${{ github.event.pull_request.number }}
|
||||
DEST_DIR: unraid-api/pr/${{ github.event.pull_request.number }}
|
||||
- name: Print Path to Plugin Install
|
||||
run: |
|
||||
echo "Use the following URL to install the plugin on your Unraid server"
|
||||
echo "https://${{ secrets.CF_BUCKET_PREVIEW }}.${{ secrets.CF_ENDPOINT }}/unraid-api/${{ github.event.pull_request.number }}/dynamix.unraid.net.staging.txz"
|
||||
echo "https://${{ secrets.CF_BUCKET_PREVIEW }}.${{ secrets.CF_ENDPOINT }}/unraid-api/pr/${{ github.event.pull_request.number }}/dynamix.unraid.net.staging.txz"
|
||||
|
||||
release-staging:
|
||||
environment:
|
||||
|
||||
@@ -15,7 +15,8 @@
|
||||
<!ENTITY NODE_SHA256 "332f22a2a6722e9fad92b8d1eeaded228a6499b7335b2b54ee99c55b4fe49742">
|
||||
<!ENTITY NGHTTP3 "nghttp3-1.6.0-x86_64.txz">
|
||||
<!ENTITY NGHTTP3_SHA256 "936c40071a99745efa35b1b8c9252b6d25b54e264cfafafca15b3f41d65ab8a6">
|
||||
<!ENTITY downloadserver "">
|
||||
<!ENTITY MAIN_TXZ "">
|
||||
<!ENTITY API_TGZ "">
|
||||
]>
|
||||
|
||||
<PLUGIN name="&name;" author="&author;" version="&version;" pluginURL="&pluginURL;" launch="&launch;" min="6.9.0-rc1" icon="globe">
|
||||
@@ -50,7 +51,6 @@ exit 0
|
||||
<!-- gzip check, DNS check, then validate files before doing anything destructive -->
|
||||
<FILE Run="/bin/bash" Method="install">
|
||||
<INLINE>
|
||||
DLHOST=$(echo "&downloadserver;" | awk -F/ '{print $3}')
|
||||
<![CDATA[
|
||||
version=
|
||||
# shellcheck disable=SC1091
|
||||
@@ -75,7 +75,6 @@ source <(grep "DNS_SERVER1" /usr/local/emhttp/state/network.ini 2>/dev/null)
|
||||
DNSERR=no
|
||||
|
||||
echo "Checking DNS..."
|
||||
#dnscheck "${DLHOST}"
|
||||
dnscheck "mothership.unraid.net"
|
||||
#dnscheck "wanip4.unraid.net"
|
||||
#dnscheck "backup.unraid.net"
|
||||
@@ -124,13 +123,13 @@ exit 0
|
||||
|
||||
<!-- download main txz -->
|
||||
<FILE Name="&source;.txz">
|
||||
<URL>&downloadserver;/unraid-api/&name;-&version;.txz</URL>
|
||||
<URL>&MAIN_TXZ;</URL>
|
||||
<SHA256>&SHA256;</SHA256>
|
||||
</FILE>
|
||||
|
||||
<!-- download unraid-api -->
|
||||
<FILE Name="/boot/config/plugins/dynamix.my.servers/unraid-api.tgz">
|
||||
<URL>&downloadserver;/unraid-api/unraid-api-&API_version;.tgz</URL>
|
||||
<URL>&API_TGZ;</URL>
|
||||
<SHA256>&API_SHA256;</SHA256>
|
||||
</FILE>
|
||||
|
||||
|
||||
@@ -5,6 +5,9 @@
|
||||
[[ "$1" == "p" ]] && env=production
|
||||
[[ -z "${env}" ]] && echo "usage: [s|p]" && exit 1
|
||||
|
||||
# If we have a second parameter, it's the PR number (for Pull request builds)
|
||||
[[ -n "$2" ]] && PR="$2" || PR=""
|
||||
|
||||
DIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
|
||||
MAINDIR=$(dirname "$(dirname "${DIR}")")
|
||||
tmpdir=/tmp/tmp.$((RANDOM * 19318203981230 + 40))
|
||||
@@ -46,10 +49,18 @@ cd "${DIR}" || exit 1
|
||||
|
||||
# define vars for plg
|
||||
pluginURL="https://stable.dl.unraid.net/unraid-api/\&name;.plg"
|
||||
downloadserver="https://stable.dl.unraid.net"
|
||||
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"
|
||||
# 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"
|
||||
pluginURL="https://preview.dl.unraid.net/unraid-api/pr/${PR}\&name;.plg"
|
||||
fi
|
||||
if [[ "${env}" == "staging" ]]; then
|
||||
pluginURL="https://preview.dl.unraid.net/unraid-api/\&name;.plg"
|
||||
downloadserver="https://preview.dl.unraid.net"
|
||||
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"
|
||||
fi
|
||||
|
||||
# update plg file
|
||||
@@ -58,7 +69,8 @@ sed -i -E "s#(ENTITY env\s*)\".*\"#\1\"${env}\"#g" "${plgfile}"
|
||||
sed -i -E "s#(ENTITY version\s*)\".*\"#\1\"${version}\"#g" "${plgfile}"
|
||||
sed -i -E "s#(ENTITY pluginURL\s*)\".*\"#\1\"${pluginURL}\"#g" "${plgfile}"
|
||||
sed -i -E "s#(ENTITY SHA256\s*)\".*\"#\1\"${sha256}\"#g" "${plgfile}"
|
||||
sed -i -E "s#(ENTITY downloadserver\s*)\".*\"#\1\"${downloadserver}\"#g" "${plgfile}"
|
||||
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}"
|
||||
|
||||
# set from environment vars
|
||||
sed -i -E "s#(ENTITY API_version\s*)\".*\"#\1\"${API_VERSION}\"#g" "${plgfile}"
|
||||
|
||||
Reference in New Issue
Block a user