Skip to content

Commit

Permalink
mongodb-setup.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
LVivona authored Oct 30, 2024
1 parent 91d238a commit 45864d0
Showing 1 changed file with 5 additions and 39 deletions.
44 changes: 5 additions & 39 deletions .github/workflows/mongodb-setup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,47 +2,13 @@ on: [push]

name: Atlas CLI Action Sample

env:
MONGODB_ATLAS_PUBLIC_API_KEY: ${{ secrets.PUBLIC_API_KEY }}
MONGODB_ATLAS_PRIVATE_API_KEY: ${{ secrets.PRIVATE_API_KEY }}
MONGODB_ATLAS_ORG_ID: ${{ secrets.ORG_ID }} # default organization ID
MONGODB_ATLAS_PROJECT_ID: ${{ secrets.PROJECT_ID }} # default project ID

jobs:
setup:
use-atlas-cli:
runs-on: ubuntu-latest

steps:
- name: Check Out Repository
uses: actions/checkout@v2

- name: Authenticate MongoDB Atlas CLI
run: |
atlas config init --publicApiKey "$MONGODB_ATLAS_PUBLIC_API_KEY" --privateApiKey "$MONGODB_ATLAS_PRIVATE_API_KEY" --orgId "$MONGODB_ATLAS_ORG_ID"
- name: Setup AtlasCLI and create a project
id: create-project
- name: Setup AtlasCLI
uses: mongodb/[email protected]
with:
create-project-name: test-setup-project

- name: Run setup
id: setup
uses: mongodb/[email protected]
with:
run-setup: true
project-id: ${{ steps.create-project.outputs.create-project-id }}
cluster-name: test-cluster
username: ${{ secrets.MONGODB_USER }}
password: ${{ secrets.MONGODB_PASSWORD }}

- name: Retrieve Connection String
- name: Use AtlasCLI
shell: bash
run: |
echo "${{ steps.setup.outputs.connection-string }}"
- name: Teardown
uses: mongodb/[email protected]
with:
delete-project-id: ${{ steps.create-project.outputs.create-project-id }}
delete-cluster-name: test-cluster
run: atlas --version # Print Atlas CLI Version

0 comments on commit 45864d0

Please sign in to comment.