Skip to content

fix(package): take the release asset extension from the basename #15

fix(package): take the release asset extension from the basename

fix(package): take the release asset extension from the basename #15

Workflow file for this run

name: Release tags
# Three levels, so a consumer picks how much movement they want:
#
# @v4.2.0 never moves — an exact release
# @v4.2 follows the newest v4.2.x — bug fixes, no new behaviour
# @v4 follows the newest v4.x.y — the usual choice
#
# Pushing v4.2.0 moves v4.2 and v4 to it. They are only ever moved by a
# release, never by a commit to main, so `main` being ahead is normal and
# nobody is consuming it by accident.
#
# The wrappers reach for each other as dAppCore/build/actions/...@v4, which
# means a sub-action is invisible to a running job until a release includes it.
# New sub-actions therefore need a release cut before their CI can pass — that
# is the cost of the floating tag, and it is why releases here are cheap and
# frequent rather than ceremonial.
on:
push:
tags: ["v[0-9]+.[0-9]+.[0-9]+"]
workflow_dispatch:
inputs:
version:
description: "Exact release tag to point the floating tags at, e.g. v4.2.0"
required: true
permissions:
contents: write
concurrency:
group: release-tags
cancel-in-progress: false
jobs:
move:
name: Move the floating tags
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Move v<major> and v<major>.<minor>
shell: bash
env:
REQUESTED: ${{ inputs.version }}
run: |
set -euo pipefail
VERSION="${REQUESTED:-${GITHUB_REF_NAME}}"
if ! printf '%s' "$VERSION" | grep -qE '^v[0-9]+\.[0-9]+\.[0-9]+$'; then
echo "::error::'$VERSION' is not a vMAJOR.MINOR.PATCH tag"
exit 1
fi
# Resolve through the tag rather than using GITHUB_SHA, so a manual
# run points at what the release actually is.
TARGET="$(git rev-list -n1 "$VERSION")"
MAJOR="${VERSION%%.*}"
MINOR="${VERSION%.*}"
# Refuse to move a major tag backwards. A force-push that rewinds @v4
# would downgrade every workflow using it, silently.
for FLOAT in "$MAJOR" "$MINOR"; do
if git rev-parse -q --verify "refs/tags/$FLOAT" >/dev/null; then
CURRENT="$(git rev-list -n1 "$FLOAT")"
if [ "$CURRENT" = "$TARGET" ]; then
echo "[DEBUG_LOG] $FLOAT already at $TARGET"
continue
fi
if ! git merge-base --is-ancestor "$CURRENT" "$TARGET"; then
echo "::error::$FLOAT currently points at $CURRENT, which is not an ancestor of $VERSION — moving it would rewind consumers"
exit 1
fi
fi
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag -f "$FLOAT" "$TARGET"
git push --force origin "refs/tags/$FLOAT"
echo "[DEBUG_LOG] $FLOAT -> $VERSION ($TARGET)"
done