Skip to content

Switch to Github latest release #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/external_trigger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ jobs:
echo "> [!NOTE]" >> $GITHUB_STEP_SUMMARY
echo "> External trigger running off of master branch. To disable this trigger, add \`freecad_master\` into the Github organizational variable \`SKIP_EXTERNAL_TRIGGER\`." >> $GITHUB_STEP_SUMMARY
printf "\n## Retrieving external version\n\n" >> $GITHUB_STEP_SUMMARY
EXT_RELEASE=$(curl -sX GET https://ftp.debian.org/debian/dists/bookworm/main/binary-amd64/Packages.gz | gunzip |grep -A 7 -m 1 'Package: freecad' | awk -F ': ' '/Version/{print $2;exit}' | awk -F '+' '{print $1}')
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/FreeCAD/FreeCAD/releases/latest" | jq -r '. | .tag_name')
echo "Type is \`github_stable\`" >> $GITHUB_STEP_SUMMARY
if grep -q "^freecad_master_${EXT_RELEASE}" <<< "${SKIP_EXTERNAL_TRIGGER}"; then
echo "> [!WARNING]" >> $GITHUB_STEP_SUMMARY
echo "> Github organizational variable \`SKIP_EXTERNAL_TRIGGER\` matches current external release; skipping trigger." >> $GITHUB_STEP_SUMMARY
Expand Down
26 changes: 18 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,24 @@ ENV TITLE=FreeCAD
RUN \
echo "**** add icon ****" && \
curl -o \
/kclient/public/icon.png \
https://raw.githubusercontent.com/linuxserver/docker-templates/master/linuxserver.io/img/freecad-logo.png && \
echo "**** install packages ****" && \
apt-get update && \
apt-get install -y --no-install-recommends \
freecad \
python3-pyside2.qtwebchannel \
python3-pyside2.qtwebengine* && \
/usr/share/icons/hicolor/48x48/apps/freecad.png \
https://raw.githubusercontent.com/linuxserver/docker-templates/master/linuxserver.io/img/freecad-logo.png
RUN \
echo " install freecad from appimage " && \
if [ -z ${FREECAD_VERSION+x} ]; then \
FREECAD_URL=$(curl -sX GET "https://api.github.com/repos/FreeCAD/FreeCAD/releases/latest" | jq -r '.assets[] | select(.name | contains("Linux") and contains("x86_64")) | select(.name | contains("SHA256") | not) | .browser_download_url'); \
else \
ASSETS_URL=$(curl -sX GET "https://api.github.com/repos/FreeCAD/FreeCAD/releases/tags/${FREECAD_VERSION}" | jq -r '.assets_url'); \
FREECAD_URL=$(curl -sX GET "$ASSETS_URL" | jq -r '.[] | select(.name | contains("Linux") and contains("x86_64") and (contains("SHA256") | not) and (contains(".zsync") | not)) | .browser_download_url'); \
fi && \
echo "Downloading FreeCAD from: ${FREECAD_URL}" && \
cd /tmp && \
curl -o /tmp/freecad.app -L ${FREECAD_URL} && \
chmod +x /tmp/freecad.app && \
./freecad.app --appimage-extract && \
mv squashfs-root /opt/freecad && \
ln -s /opt/freecad/AppRun /usr/bin/freecad && \
sed -i 's|</applications>| <application title="FreeCAD*" type="normal">\n <maximized>yes</maximized>\n </application>\n</applications>|' /etc/xdg/openbox/rc.xml && \
echo "**** cleanup ****" && \
apt-get autoclean && \
rm -rf \
Expand Down
25 changes: 17 additions & 8 deletions Dockerfile.aarch64
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,23 @@ ENV TITLE=FreeCAD
RUN \
echo "**** add icon ****" && \
curl -o \
/kclient/public/icon.png \
https://raw.githubusercontent.com/linuxserver/docker-templates/master/linuxserver.io/img/freecad-logo.png && \
echo "**** install packages ****" && \
apt-get update && \
apt-get install -y --no-install-recommends \
freecad \
python3-pyside2.qtwebchannel \
python3-pyside2.qtwebengine* && \
/usr/share/icons/hicolor/48x48/apps/freecad.png \
https://raw.githubusercontent.com/linuxserver/docker-templates/master/linuxserver.io/img/freecad-logo.png
RUN \
echo " install freecad from appimage " && \
if [ -z ${FREECAD_VERSION+x} ]; then \
FREECAD_URL=$(curl -sX GET "https://api.github.com/repos/FreeCAD/FreeCAD/releases/latest" | jq -r '.assets[] | select(.name | contains("Linux") and contains("aarch64")) | select(.name | contains("SHA256") | not) | .browser_download_url'); \
else \
ASSETS_URL=$(curl -sX GET "https://api.github.com/repos/FreeCAD/FreeCAD/releases/tags/${FREECAD_VERSION}" | jq -r '.assets_url'); \
FREECAD_URL=$(curl -sX GET "$ASSETS_URL" | jq -r '.[] | select(.name | contains("Linux") and contains("aarch64") and (contains("SHA256") | not) and (contains(".zsync") | not)) | .browser_download_url'); \
fi && \
echo "Downloading FreeCAD from: ${FREECAD_URL}" && \
cd /tmp && \
curl -o /tmp/freecad.app -L ${FREECAD_URL} && \
chmod +x /tmp/freecad.app && \
./freecad.app --appimage-extract && \
mv squashfs-root /opt/freecad && \
ln -s /opt/freecad/AppRun /usr/bin/freecad && \
sed -i 's|</applications>| <application title="FreeCAD*" type="normal">\n <maximized>yes</maximized>\n </application>\n</applications>|' /etc/xdg/openbox/rc.xml && \
echo "**** cleanup ****" && \
apt-get autoclean && \
Expand Down
13 changes: 9 additions & 4 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -138,17 +138,22 @@ pipeline {
/* ########################
External Release Tagging
######################## */
// If this is a custom command to determine version use that command
stage("Set tag custom bash"){
// 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 -sX GET https://ftp.debian.org/debian/dists/bookworm/main/binary-amd64/Packages.gz | gunzip |grep -A 7 -m 1 'Package: freecad' | awk -F ': ' '/Version/{print $2;exit}' | awk -F '+' '{print $1}' ''',
script: '''curl -H "Authorization: token ${GITHUB_TOKEN}" -s https://api.github.com/repos/FreeCAD/FreeCAD/releases/latest | jq -r '. | .tag_name' ''',
returnStdout: true).trim()
env.RELEASE_LINK = 'custom_command'
}
}
}
// 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/FreeCAD/FreeCAD/releases/tag/' + env.EXT_RELEASE
}
// Sanitize the release tag and strip illegal docker or github characters
stage("Sanitize tag"){
steps{
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-freecad
external_type: na
custom_version_command: "curl -sX GET https://ftp.debian.org/debian/dists/bookworm/main/binary-amd64/Packages.gz | gunzip |grep -A 7 -m 1 'Package: freecad' | awk -F ': ' '/Version/{print $2;exit}' | awk -F '+' '{print $1}'"
external_type: github_stable
custom_version_command: "curl -sX GET 'https://api.github.com/repos/FreeCAD/FreeCAD/releases/latest' | awk -F'\"' '/\"tag_name\":/{ print $4; exit }'"
release_type: stable
release_tag: latest
ls_branch: master
build_armhf: false
repo_vars:
- EXT_USER = 'FreeCAD'
- EXT_REPO = 'FreeCAD'
- BUILD_VERSION_ARG = 'FREECAD_VERSION'
- LS_USER = 'linuxserver'
- LS_REPO = 'docker-freecad'
Expand Down