Adjusted the naming of prusa_slicer to prusaslicer and also forked the tag script for the GitHub Action to automatically tag when a new version of Prusaslicer is available.

This commit is contained in:
Michael Helfrich 2022-02-04 18:54:16 -05:00
parent 820ed3fe27
commit 23e970957f
3 changed files with 60 additions and 4 deletions

View File

@ -35,7 +35,7 @@ ENV LC_ALL en_US.UTF-8
# Many of the commands below were derived and pulled from previous work by dmagyar on GitHub.
# Here's their Dockerfile for reference https://github.com/dmagyar/prusaslicer-vnc-docker/blob/main/Dockerfile.amd64
WORKDIR /slic3r
ADD get_latest_prusa_slicer_release.sh /slic3r
ADD get_latest_prusaslicer_release.sh /slic3r
RUN apt-get update && apt-get install -y \
jq \
@ -45,9 +45,9 @@ RUN apt-get update && apt-get install -y \
bzip2 \
git \
--no-install-recommends \
&& chmod +x /slic3r/get_latest_prusa_slicer_release.sh \
&& latestSlic3r=$(/slic3r/get_latest_prusa_slicer_release.sh url) \
&& slic3rReleaseName=$(/slic3r/get_latest_prusa_slicer_release.sh name) \
&& chmod +x /slic3r/get_latest_prusaslicer_release.sh \
&& latestSlic3r=$(/slic3r/get_latest_prusaslicer_release.sh url) \
&& slic3rReleaseName=$(/slic3r/get_latest_prusaslicer_release.sh name) \
&& curl -sSL ${latestSlic3r} > ${slic3rReleaseName} \
&& rm -f /slic3r/releaseInfo.json \
&& mkdir -p /slic3r/slic3r-dist \

56
tag_latest_prusaslicer.sh Normal file
View File

@ -0,0 +1,56 @@
#!/bin/bash
# tagLatestPrusaSlicer.sh
# Push a tag for our repository if upstream PrusaSlicer generates a new release
# This was forked from https://github.com/dmagyar/prusaslicer-vnc-docker/blob/main/tagLatestPrusaSlicer.sh
set -eu
# ** start of configurable variables **
# GH_ACTION -- indicates that we are running in a github action, and instead of pushing, just use
# return codes to indicate whether or not continuing with the workflow is appropriate
GH_ACTION="y"
# LATEST_RELEASE -- where to find the latest PrusaSlicer release
LATEST_RELEASE="https://api.github.com/repos/prusa3d/PrusaSlicer/releases/latest"
# ** end of configurable variables **
# Get the latest tagged version
LATEST_VERSION="$(curl -SsL ${LATEST_RELEASE} | jq -r '.tag_name | select(test("^version_[0-9]{1,2}\\.[0-9]{1,2}\\.[0-9]{1,2}\\-{0,1}(\\w+){0,1}$"))' | cut -d_ -f2)"
if [[ -z "${LATEST_VERSION}" ]]; then
echo "Could not determine the latest version."
echo "Has release naming changed from previous conventions?"
echo "${LATEST_VERSION}"
exit 1
fi
# Run from the git repository
cd "$(dirname "$0")";
# Get the latest tag (by tag date, not commit) in our repository
LATEST_GIT_TAG=$(git for-each-ref refs/tags --sort=-creatordate --format='%(refname:short)' --count=1)
if [[ "${LATEST_GIT_TAG}" != "${LATEST_VERSION}" ]]; then
echo "Update needed. Latest tag ver: ${LATEST_GIT_TAG} != upstream ver: ${LATEST_VERSION} .."
git tag "${LATEST_VERSION}"
if [[ "$GH_ACTION" != "" ]]; then
echo "${LATEST_VERSION}" > ${GITHUB_WORKSPACE}/VERSION
git push https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$GITHUB_REPOSITORY --tags
exit 0
else
git push --tags
fi
else
echo "Latest tag ver: ${LATEST_GIT_TAG} == upstream ver: ${LATEST_VERSION} -- no update"
exit 0
fi