@@ -17,8 +17,10 @@ pipeline {
1717 GITLAB_TOKEN = credentials(' b6f0f1dd-6952-4cf6-95d1-9c06380283f0' )
1818 GITLAB_NAMESPACE = credentials(' gitlab-namespace-id' )
1919 SCARF_TOKEN = credentials(' scarf_api_key' )
20- EXT_PIP = ' pyload-ng'
21- BUILD_VERSION_ARG = ' PYLOAD_VERSION'
20+ EXT_GIT_BRANCH = ' develop'
21+ EXT_USER = ' pyload'
22+ EXT_REPO = ' pyload'
23+ BUILD_VERSION_ARG = ' PYLOAD_COMMIT'
2224 LS_USER = ' linuxserver'
2325 LS_REPO = ' docker-pyload'
2426 CONTAINER_NAME = ' pyload'
@@ -100,17 +102,25 @@ pipeline {
100102 /* ########################
101103 External Release Tagging
102104 ######################## */
103- // If this is a pip release set the external tag to the pip version
104- stage(" Set ENV pip_version" ){
105- steps{
106- script{
107- env. EXT_RELEASE = sh(
108- script : ''' curl -sL https://pypi.python.org/pypi/${EXT_PIP}/json |jq -r '. | .info.version' ''' ,
109- returnStdout : true ). trim()
110- env. RELEASE_LINK = ' https://pypi.python.org/pypi/' + env. EXT_PIP
111- }
112- }
113- } // Sanitize the release tag and strip illegal docker or github characters
105+ // If this is a github commit trigger determine the current commit at head
106+ stage(" Set ENV github_commit" ){
107+ steps{
108+ script{
109+ env. EXT_RELEASE = sh(
110+ script : ''' curl -H "Authorization: token ${GITHUB_TOKEN}" -s https://api.github.com/repos/${EXT_USER}/${EXT_REPO}/commits/${EXT_GIT_BRANCH} | jq -r '. | .sha' | cut -c1-8 ''' ,
111+ returnStdout : true ). trim()
112+ }
113+ }
114+ }
115+ // If this is a github commit trigger Set the external release link
116+ stage(" Set ENV commit_link" ){
117+ steps{
118+ script{
119+ env. RELEASE_LINK = ' https://github.com/' + env. EXT_USER + ' /' + env. EXT_REPO + ' /commit/' + env. EXT_RELEASE
120+ }
121+ }
122+ }
123+ // Sanitize the release tag and strip illegal docker or github characters
114124 stage(" Sanitize tag" ){
115125 steps{
116126 script{
@@ -909,11 +919,11 @@ pipeline {
909919 "tagger": {"name": "LinuxServer Jenkins","email": "[email protected] ","date": "'${GITHUB_DATE}'"}}' ''' 910920 echo " Pushing New release for Tag"
911921 sh ''' #! /bin/bash
912- echo "Updating PIP version of ${EXT_PIP} to ${ EXT_RELEASE_CLEAN}" > releasebody.json
922+ curl -H "Authorization: token ${GITHUB_TOKEN}" -s https://api.github.com/repos/${EXT_USER}/${EXT_REPO}/commits/${ EXT_RELEASE_CLEAN} | jq '.commit.message' | sed 's:^. \\ (.* \\ ).$: \\ 1:' > releasebody.json
913923 echo '{"tag_name":"'${META_TAG}'",\
914924 "target_commitish": "main",\
915925 "name": "'${META_TAG}'",\
916- "body": "**LinuxServer Changes:**\\ n\\ n'${LS_RELEASE_NOTES}'\\ n\\ n**PIP Changes:**\\ n\\ n' > start
926+ "body": "**LinuxServer Changes:**\\ n\\ n'${LS_RELEASE_NOTES}'\\ n\\ n**'${EXT_REPO}' Changes:**\\ n\\ n' > start
917927 printf '","draft": false,"prerelease": false}' >> releasebody.json
918928 paste -d'\\ 0' start releasebody.json > releasebody.json.done
919929 curl -H "Authorization: token ${GITHUB_TOKEN}" -X POST https://api.github.com/repos/${LS_USER}/${LS_REPO}/releases -d @releasebody.json.done'''
0 commit comments