Release scripts commonly turn a version number into a tag name and a short status line.

Program

Play the script to choose a version and see the generated release tag.

version
release_tag.sh
Replay: real traced execution (multi-file project)
#!/usr/bin/env bash

version="1.4.0"
prefix="v"
tag="${prefix}${version}"
echo "tag=$tag"
#!/usr/bin/env bash

version="1.5.0"
prefix="v"
tag="${prefix}${version}"
echo "tag=$tag"
  1. version ← 1.4.0

    3version="1.4.0"4prefix="v"
    values this step1.4.0version
  2. prefix ← v

    3version="1.4.0"4prefix="v"5tag="${prefix}${version}"
    values this stepvprefix
  3. tag ← v1.4.0

    4prefix="v"5tag="${prefix}${version}"6echo "tag=$tag"
    values this stepv1.4.0tagvprefix1.4.0version
  4. echo "tag=$tag"

    5tag="${prefix}${version}"6echo "tag=$tag"
    outputtag=v1.4.0
    values this stepv1.4.0tag
  1. version ← 1.5.0

    3version="1.5.0"4prefix="v"
    values this step1.5.0version
  2. prefix ← v

    3version="1.5.0"4prefix="v"5tag="${prefix}${version}"
    values this stepvprefix
  3. tag ← v1.5.0

    4prefix="v"5tag="${prefix}${version}"6echo "tag=$tag"
    values this stepv1.5.0tagvprefix1.5.0version
  4. echo "tag=$tag"

    5tag="${prefix}${version}"6echo "tag=$tag"
    outputtag=v1.5.0
    values this stepv1.5.0tag
version A version string identifies the release contents.
tag prefix A small prefix policy keeps generated tags consistent.
release label The final tag can be passed to a real release command later.