Skip to content

permissions

permissions #100

name: Update tenant API
on:
push:
branches:
- 'production/**'
- 'test/**'
workflow_dispatch:
inputs:
wait_for_amplify:
description: 'Wait for Amplify build'
required: true
default: true
type: choice
options:
- true
- false
jobs:
build:
runs-on: ubuntu-latest
environment: ${{ github.ref_name }}
strategy:
matrix:
node-version: [16.x]
steps:
- name: Wait for Amplify to finish remote build
uses: duckbytes/amplify-build-status@get_env_name
with:
app-id: ${{ vars.AMPLIFY_APP_ID }}
branch-name: ${{ github.ref_name }}
commit-id: ${{ github.event.created && 'HEAD' || github.sha }}
wait: ${{ github.event_name == 'workflow_dispatch' && inputs.wait_for_amplify || true }}
id: amplify_status
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ vars.AWS_REGION }}
# - name: Install Amplify CLI and pull project
# env:
# AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
# AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# AWS_REGION: ${{ vars.AWS_REGION }}
# run: |
# npm install -g @aws-amplify/cli @babel/cli --unsafe-perm=true
# npm install --save-dev @babel/plugin-transform-modules-commonjs
# amplify pull --appId ${{ vars.AMPLIFY_APP_ID }} --envName ${{ steps.amplify_status.outputs.environment_name }} -y
# babel --plugins @babel/plugin-transform-modules-commonjs src/aws-exports.js > src/aws-exports-es5.js
# - name: Update the tenant API
# uses: platelet-app/update-tenant-api-action@main
# with:
# awsEnvName: ${{ steps.amplify_status.outputs.environment_name }}
# awsExportsFilepath: ${{ github.workspace }}/src/aws-exports-es5.js
# awsAccessKeyId: ${{ secrets.AWS_ACCESS_KEY_ID }}
# awsSecretAccessKey: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# awsRegion: ${{ vars.AWS_REGION }}
# apiURL: ${{ vars.API_URL }}
# amplifyEnvName: ${{ steps.amplify_status.outputs.environment_name }}
# tenantName: ${{ vars.TENANT_NAME }}
- name: echo log
run: |
echo ${{ steps.amplify_status.outputs.graphql_endpoint }}
- name: Register the tenant admin
uses: platelet-app/register-tenant-action@master
with:
awsAccessKeyId: ${{ secrets.AWS_ACCESS_KEY_ID }}
awsSecretAccessKey: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
awsRegion: ${{ vars.AWS_REGION }}
tenantApiUrl: ${{ steps.amplify_status.outputs.graphql_endpoint }}
tenantName: ${{ vars.TENANT_NAME }}
adminName: ${{ vars.ADMIN_NAME }}
adminEmail: ${{ vars.ADMIN_EMAIL }}