Skip to content

Cutting a release

When we “cut” a release, we begin the process of making a release. (This is not to be confused with publishing a release, which is the last step.) After a release is cut, we can perform manual QA testing and polish any remaining small changes.

  1. Set a VERSION variable in your shell

    Run this command to set a local variable within your shell to the version number of the release you’re making.

    VERSION=1.2.3 # ⚠️ CUSTOMIZE THIS
    

    Note

    Do not prefix the version with v.

  2. Cut the release branch

    Run these commands from within the repo, locally.

    git checkout develop
    git pull origin develop
    git checkout -b $VERSION
    
  3. Notify team that release branch is cut

    This is important because engineers will need to know to target the release branch with any subsequent PRs intended for the release.

  4. Update version numbers

    sed -i "s/^__version__ =.*\$/__version__ = \"$VERSION\"/" mathesar/__init__.py
    sed -i "s/^  mathesar_version:.*\$/  mathesar_version: $VERSION/" docs/mkdocs.yml
    git commit -a -m "Update version numbers to $VERSION"
    
  5. Create the release PR

    git push -u origin $VERSION
    gh pr create -d -B master -m "v$VERSION" -t "Release $VERSION" -b ""
    
  6. Publish Docker images

    1. Log in to DockerHub

      docker login
      

      (Use your personal Docker credentials. Your personal Docker account will need to be a member of our mathesar Docker org.)

    2. Locally clone the repo into a clean directory and go there.

      REPO_DIR=$(pwd)
      CLEAN_REPO_DIR=$(mktemp -d)
      cd $CLEAN_REPO_DIR
      git clone -b $VERSION --single-branch --no-tags "$REPO_DIR" .
      

      (This ensures that files which are ignored by git don’t end up in the Docker image.)

    3. Build and push images to DockerHub

      docker buildx build \
        -t mathesar/mathesar-caddy:$VERSION \
        --builder=cloud-mathesar-release-builder \
        --platform=linux/amd64,linux/arm64 \
        --push \
        -f Dockerfile.caddy .
      
      docker buildx build \
        -t mathesar/mathesar-prod:$VERSION \
        --builder=cloud-mathesar-release-builder \
        --platform=linux/amd64,linux/arm64 \
        --push .
      

      (These images are intentionally not tagged as latest — that will happen during publication.)

      If you have trouble running these commands, make sure you’ve run the prerequisite setup steps.

    4. Clean up

      cd "$REPO_DIR"
      rm -rf $CLEAN_REPO_DIR
      docker logout