Skip to content

Cirrus CI

An example YAML file for configuring Uplift to run on Cirrus CI. Access to GitHub is managed through their dedicated GitHub Application. As Uplift requires write permissions to your repository, a Personal Access Token needs to be configured with the public_repo permission and added to Cirrus CI as an encrypted variable.

# .cirrus.yml

task:
  name: Release
  # Only run on the main branch
  only_if: $BRANCH == "main" && $CIRRUS_TAG == ""
  container:
    image: gembaadvantage/uplift:latest
  before_script:
    - CLONE_URL=${CIRRUS_REPO_CLONE_URL#"https://"}
    - git remote set-url origin "https://${GITHUB_TOKEN}@${CLONE_URL}"
  release_script:
    - uplift release --fetch-all # (1)
  environment:
    GITHUB_TOKEN: ENCRYPTED[!ID!] # (2)
  1. As Cirrus CI uses go-git for cloning repositories from GitHub, by default, it doesn't fetch tags. Using the --fetch-all flag with Uplift ensures all tags are pulled before attempting a release
  2. !ID! should be replaced with the internal ID generated by Cirrus CI. GITHUB_TOKEN can be replaced with any chosen variable name and must be reflected in the remote URL. environment and env are interchangeable.

Uplift publishes docker images that support both amd64 and arm64 architectures, Cirrus CI can be configured to use arm64:

# .cirrus.yml

task:
  name: Release
  # Only run on the main branch
  only_if: $BRANCH == "main" && $CIRRUS_TAG == ""
  arm_container:
    image: gembaadvantage/uplift:latest # (1)
  before_script:
    - CLONE_URL=${CIRRUS_REPO_CLONE_URL#"https://"}
    - git remote set-url origin "https://${GITHUB_TOKEN}@${CLONE_URL}"
  release_script:
    - uplift release --fetch-all
  environment:
    GITHUB_TOKEN: ENCRYPTED[!ID!]
  1. Cirrus CI will seamlessly download the arm64 image from either DockerHub or GHCR through the use of the --platform flag.