Skip to content

Commit

Permalink
switch versioning to benefit from upstream release notes
Browse files Browse the repository at this point in the history
  • Loading branch information
aptalca committed Sep 12, 2024
1 parent 2161eb2 commit 733f5f2
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 18 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/external_trigger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ jobs:
echo "> [!NOTE]" >> $GITHUB_STEP_SUMMARY
echo "> External trigger running off of main branch. To disable this trigger, set a Github secret named \`PAUSE_EXTERNAL_TRIGGER_YAAK_MAIN\`" >> $GITHUB_STEP_SUMMARY
printf "\n## Retrieving external version\n\n" >> $GITHUB_STEP_SUMMARY
EXT_RELEASE=$(curl -u ${{ secrets.CR_USER }}:${{ secrets.CR_PAT }} -sX GET "https://api.github.com/repos/yaakapp/app/releases/latest" | jq -r .tag_name | sed 's|^v||')
echo "Type is \`custom_version_command\`" >> $GITHUB_STEP_SUMMARY
EXT_RELEASE=$(curl -u "${{ secrets.CR_USER }}:${{ secrets.CR_PAT }}" -sX GET "https://api.github.com/repos/yaakapp/app/releases/latest" | jq -r '. | .tag_name')
echo "Type is \`github_stable\`" >> $GITHUB_STEP_SUMMARY
if [ -z "${EXT_RELEASE}" ] || [ "${EXT_RELEASE}" == "null" ]; then
echo "> [!WARNING]" >> $GITHUB_STEP_SUMMARY
echo "> Can't retrieve external version, exiting" >> $GITHUB_STEP_SUMMARY
Expand Down
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@ RUN \
apt-get update && \
if [ -z ${YAAK_RELEASE+x} ]; then \
YAAK_RELEASE=$(curl -sX GET "https://api.github.com/repos/yaakapp/app/releases/latest" \
| jq -r .tag_name | sed 's|^v||'); \
| jq -r .tag_name); \
fi && \
YAAK_VERSION=$(echo "${YAAK_RELEASE}" | sed 's|^v||') && \
curl -o \
/tmp/yaak.deb -L \
"https://github.com/yaakapp/app/releases/download/v${YAAK_RELEASE}/yaak_${YAAK_RELEASE}_amd64.deb" && \
"https://github.com/yaakapp/app/releases/download/v${YAAK_VERSION}/yaak_${YAAK_VERSION}_amd64.deb" && \
apt-get install -y --no-install-recommends \
/tmp/yaak.deb && \
printf "Linuxserver.io version: ${VERSION}\nBuild-date: ${BUILD_DATE}" > /build_version && \
Expand Down
34 changes: 22 additions & 12 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ pipeline {
DOCKERHUB_TOKEN=credentials('docker-hub-ci-pat')
QUAYIO_API_TOKEN=credentials('quayio-repo-api-token')
GIT_SIGNING_KEY=credentials('484fbca6-9a4f-455e-b9e3-97ac98785f5f')
EXT_GIT_BRANCH = 'master'
EXT_USER = 'yaakapp'
EXT_REPO = 'app'
BUILD_VERSION_ARG = 'YAAK_RELEASE'
LS_USER = 'linuxserver'
LS_REPO = 'docker-yaak'
Expand Down Expand Up @@ -126,16 +129,23 @@ pipeline {
/* ########################
External Release Tagging
######################## */
// If this is a custom command to determine version use that command
stage("Set tag custom bash"){
steps{
script{
env.EXT_RELEASE = sh(
script: ''' curl -sX GET "https://api.github.com/repos/yaakapp/app/releases/latest" | jq -r .tag_name | sed 's|^v||' ''',
returnStdout: true).trim()
env.RELEASE_LINK = 'custom_command'
}
}
// If this is a stable github release use the latest endpoint from github to determine the ext tag
stage("Set ENV github_stable"){
steps{
script{
env.EXT_RELEASE = sh(
script: '''curl -H "Authorization: token ${GITHUB_TOKEN}" -s https://api.github.com/repos/${EXT_USER}/${EXT_REPO}/releases/latest | jq -r '. | .tag_name' ''',
returnStdout: true).trim()
}
}
}
// If this is a stable or devel github release generate the link for the build message
stage("Set ENV github_link"){
steps{
script{
env.RELEASE_LINK = 'https://github.com/' + env.EXT_USER + '/' + env.EXT_REPO + '/releases/tag/' + env.EXT_RELEASE
}
}
}
// Sanitize the release tag and strip illegal docker or github characters
stage("Sanitize tag"){
Expand Down Expand Up @@ -870,11 +880,11 @@ pipeline {
"tagger": {"name": "LinuxServer-CI","email": "[email protected]","date": "'${GITHUB_DATE}'"}}' '''
echo "Pushing New release for Tag"
sh '''#! /bin/bash
echo "Updating to ${EXT_RELEASE_CLEAN}" > releasebody.json
curl -H "Authorization: token ${GITHUB_TOKEN}" -s https://api.github.com/repos/${EXT_USER}/${EXT_REPO}/releases/latest | jq '. |.body' | sed 's:^.\\(.*\\).$:\\1:' > releasebody.json
echo '{"tag_name":"'${META_TAG}'",\
"target_commitish": "main",\
"name": "'${META_TAG}'",\
"body": "**LinuxServer Changes:**\\n\\n'${LS_RELEASE_NOTES}'\\n\\n**Remote Changes:**\\n\\n' > start
"body": "**LinuxServer Changes:**\\n\\n'${LS_RELEASE_NOTES}'\\n\\n**'${EXT_REPO}' Changes:**\\n\\n' > start
printf '","draft": false,"prerelease": false}' >> releasebody.json
paste -d'\\0' start releasebody.json > releasebody.json.done
curl -H "Authorization: token ${GITHUB_TOKEN}" -X POST https://api.github.com/repos/${LS_USER}/${LS_REPO}/releases -d @releasebody.json.done'''
Expand Down
6 changes: 4 additions & 2 deletions jenkins-vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@

# jenkins variables
project_name: docker-yaak
external_type: na
custom_version_command: curl -sX GET "https://api.github.com/repos/yaakapp/app/releases/latest" | jq -r .tag_name | sed 's|^v||'
external_type: github_stable
release_type: stable
release_tag: latest
ls_branch: main
build_armhf: false
repo_vars:
- EXT_GIT_BRANCH = 'master'
- EXT_USER = 'yaakapp'
- EXT_REPO = 'app'
- BUILD_VERSION_ARG = 'YAAK_RELEASE'
- LS_USER = 'linuxserver'
- LS_REPO = 'docker-yaak'
Expand Down

0 comments on commit 733f5f2

Please sign in to comment.