What is the recommended way to install the Atlas CLI on github actions?

I’m trying to develop a script that will use MongoDB Atlas CLI to do an automatic point-in-time recovery operation if db migrations fail.

I intend to run this on Github actions. My question is therefore, how do I install the Atlas CLI on Github actions?

Based on this page, the recommended way might be to follow the guidelines for ubuntu there, so something like this?

 name: Install MongoDB Atlas CLI

on: [push]

jobs:
  install-cli:
    runs-on: ubuntu-latest

    steps:
    - name: Checkout code
      uses: actions/checkout@v2

    - name: Install MongoDB Atlas CLI
      run: |
        sudo apt-get install gnupg
        wget -qO - https://pgp.mongodb.com/server-6.0.asc | sudo apt-key add -
        echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list
        sudo apt-get update
        sudo apt-get install -y mongodb-atlas-cli
        atlas --version

Thanks in advance :pray:

Hi @Alex_Bjorlig ,

Sorry for the late response here. Have you had a chance to try the official GitHub Action for Atlas CLI?

Thanks,
Jakub

I will give it a try

Thanks Alex,

Once you get a chance to give it a try, I’d be very keen to hear what you think about it and what was your experience with it.

Thanks,
Jakub

1 Like