diff --git a/.github/workflows/release-libs.yml b/.github/workflows/release-libs.yml index b73f7649574..6f1dbb509bf 100644 --- a/.github/workflows/release-libs.yml +++ b/.github/workflows/release-libs.yml @@ -47,23 +47,30 @@ jobs: with: ref: ${{ env.OF_TAG }} - - name: Read the pinned apothecary release + - name: Resolve the apothecary release id: pin shell: bash run: | set -euo pipefail - pinned=$(tr -d '[:space:]' < scripts/dev/apothecary_release 2>/dev/null || true) - # 0.12.2 and 0.12.2-RC1 both use apothecary v12.2.0. A suffix on the - # pin (v12.2.0-RC1) is that same release. download_libs.sh agrees. source scripts/dev/apothecary_release_tag.sh - suggested=$(apothecary_release_tag "$OF_TAG") - if [[ -z "$pinned" || "$pinned" == latest ]]; then - echo "::error title=Libraries not pinned::$OF_TAG pins '${pinned:-nothing}' in scripts/dev/apothecary_release, so download_libs.sh would follow apothecary's moving 'latest'. Commit the release's apothecary tag (e.g. $suggested) before tagging." - exit 1 + # scripts/dev/apothecary_release is an optional override for an + # off-formula release (e.g. v12.2.0-hotfix1); on master it is "latest" + # and ignored. For a normal release tag the apothecary release is + # derived from the tag itself: 0.12.2 and 0.12.2-RC1 both map to + # apothecary v12.2.0. download_libs.sh uses the same rule. + pinned=$(tr -d '[:space:]' < scripts/dev/apothecary_release 2>/dev/null || true) + if [[ -n "$pinned" && "$pinned" != latest ]]; then + resolved=$(apothecary_release_tag "$pinned") + echo "$OF_TAG -> apothecary $resolved (override '$pinned' in scripts/dev/apothecary_release)" + else + resolved=$(apothecary_release_tag "$OF_TAG") + if ! [[ "$resolved" =~ ^v[0-9]+\.[0-9]+\.[0-9]+ ]]; then + echo "::error title=Not a release tag::'$OF_TAG' does not look like a release tag and scripts/dev/apothecary_release has no override, so there is no apothecary release to check. Dispatch this workflow with a version tag, or commit an override." + exit 1 + fi + echo "$OF_TAG -> apothecary $resolved (derived from $OF_TAG)" fi - resolved=$(apothecary_release_tag "$pinned") echo "tag=$resolved" >> "$GITHUB_OUTPUT" - echo "$OF_TAG -> apothecary $resolved (pinned '$pinned'; version suggests $suggested)" - name: Check the apothecary release and its packages id: assets diff --git a/scripts/dev/download_libs.sh b/scripts/dev/download_libs.sh index 565b9210cca..983151bbf93 100755 --- a/scripts/dev/download_libs.sh +++ b/scripts/dev/download_libs.sh @@ -623,13 +623,15 @@ fi SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" cd "$SCRIPT_DIR" -# apothecary_release names the apothecary release this openFrameworks version -# uses: "latest" on master; a release commit pins its own (e.g. v12.2.0), so a -# checkout of that tag keeps getting the same libraries. -t overrides it -# (-t latest for the newest libraries). The platform scripts always pass -b. -# 0.12.2-RC1 and v12.2.0-RC1 are the 0.12.2 libraries, apothecary v12.2.0. +# Pick the apothecary release that supplies this openFrameworks version's +# libraries. -t wins (-t latest for the newest libraries). Otherwise: an +# override in scripts/dev/apothecary_release pins a non-formula release (e.g. +# v12.2.0-hotfix1); failing that, if HEAD sits on a release tag, derive from +# the tag (0.12.2 and 0.12.2-RC1 -> apothecary v12.2.0); failing that, the +# default (master libraries). The platform scripts always pass -b. source "$SCRIPT_DIR/apothecary_release_tag.sh" USE_PIN=0 +USE_GIT_TAG=0 if [[ $TAG == "" ]] && [[ -f "$SCRIPT_DIR/apothecary_release" ]]; then PINNED_RELEASE=$(tr -d '[:space:]' < "$SCRIPT_DIR/apothecary_release") if [[ -n $PINNED_RELEASE ]] && [[ $PINNED_RELEASE != latest ]]; then @@ -637,11 +639,20 @@ if [[ $TAG == "" ]] && [[ -f "$SCRIPT_DIR/apothecary_release" ]]; then USE_PIN=1 fi fi +if [[ $TAG == "" ]]; then + GIT_TAG=$(git -C "$SCRIPT_DIR/../.." describe --tags --exact-match HEAD 2>/dev/null || true) + if [[ -n $GIT_TAG ]] && [[ $GIT_TAG =~ ^v?[0-9]+\.[0-9]+\.[0-9]+ ]]; then + TAG="$GIT_TAG" + USE_GIT_TAG=1 + fi +fi if [[ -n $TAG ]]; then TAG=$(apothecary_release_tag "$TAG") fi if [[ $USE_PIN == 1 ]]; then - echo " Using the apothecary release pinned by scripts/dev/apothecary_release: $TAG" + echo " Using the apothecary release override from scripts/dev/apothecary_release: $TAG" +elif [[ $USE_GIT_TAG == 1 ]]; then + echo " Using the apothecary release derived from HEAD's tag $GIT_TAG: $TAG" fi if [[ $BLEEDING_EDGE = 1 ]] ; then