Skip to content

Commit

Permalink
Make realm workflow reusable
Browse files Browse the repository at this point in the history
  • Loading branch information
cesarvarela committed Jan 25, 2024
1 parent c012694 commit fa19b38
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,24 +1,36 @@
name: Realm Deploy Staging
name: Realm Deploy

on:
push:
branches:
- staging
workflow_call:
inputs:
environment:
description: The Github environment to load secrets from
type: string
required: true
sha:
description: The commit SHA to deploy
type: string
required: true

jobs:
push:
runs-on: ubuntu-latest
environment: staging
environment: ${{ inputs.environment }}
steps:
- uses: actions/checkout@v2
- name: "Install the Realm CLI"
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ inputs.sha }}

- name: "Install the Realm (Atlas) CLI"
run: |
npm install -g mongodb-realm-cli
- name: Login
run: |
realm-cli login --api-key="${{ secrets.REALM_API_PUBLIC_KEY }}" --private-api-key="${{ secrets.REALM_API_PRIVATE_KEY }}" --realm-url https://realm.mongodb.com --atlas-url https://cloud.mongodb.com
- name: Push
run: |
cd site/realm
realm-cli push --remote="${{ secrets.GATSBY_REALM_APP_ID }}" -y
7 changes: 7 additions & 0 deletions .github/workflows/staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ on:

jobs:

call-atlas:
uses: ./.github/workflows/realm.yml
secrets: inherit
with:
sha: ${{ github.sha }}
environment: staging

call-test-build:
uses: ./.github/workflows/test-build.yml
secrets: inherit
Expand Down

0 comments on commit fa19b38

Please sign in to comment.