diff --git a/.github/workflows/realm-staging.yml b/.github/workflows/realm.yml similarity index 50% rename from .github/workflows/realm-staging.yml rename to .github/workflows/realm.yml index 1a9c8298a3..598c5aa7e6 100644 --- a/.github/workflows/realm-staging.yml +++ b/.github/workflows/realm.yml @@ -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 - diff --git a/.github/workflows/staging.yml b/.github/workflows/staging.yml index 49ceb3daff..8236a33d73 100644 --- a/.github/workflows/staging.yml +++ b/.github/workflows/staging.yml @@ -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