Skip to content
Snippets Groups Projects

Deployment script

  • Clone with SSH
  • Clone with HTTPS
  • Embed
  • Share
    The snippet can be accessed without any authentication.
    Authored by Ed Rogers

    This script:

    • Takes a tag
    • Checks the tag format (it should b vX.X.X and quits if it is wrong)
    • Dumps the tag in a pretty and a raw format to version.txt which is used by my code to display version number to the user
    • Add version.txt and commits as an ammendment
    • Creates a tag with the new version number (prompting for a description as normal)
    • The last line updates my release branch to point to the current commit.
    Edited
    deploy.sh 530 B
    #!/usr/bin/env bash
    tag=$1
    if echo ${tag} | grep -qe '^v[0-9]\+\.[0-9]\+\.[0-9]\+$'
    then
        echo "Format OK"
    else
        echo "Version number does not match required format: v0.0.0"
        exit 1
    fi
    prettyVer=${tag/v/"Version "}
    echo ${prettyVer} > version.txt
    echo ${tag} >> version.txt
    echo "Setting version to:"
    cat version.txt
    git add version.txt
    git commit --amend --no-edit
    git tag -a ${tag}
    curr_branch=`git rev-parse --abbrev-ref HEAD`
    git checkout release && git merge ${curr_branch} --ff-only && git checkout ${curr_branch}
    
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Finish editing this message first!
    Please register or to comment