Skip to content

fix(supabase): fallback_role_id (#56) #164

fix(supabase): fallback_role_id (#56)

fix(supabase): fallback_role_id (#56) #164

name: build-examples
on:
push:
branches:
- main
env:
AWS_REGION: us-west-2
INDENT_TAG: ${{ github.sha }}
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
node: [16]
integration:
- okta
- aws-iam
- tailscale
- pagerduty
- opsgenie
- incidentio
- auto-approval
- okta-auto-approval
- github-issue
- cloudflare
- supabase
indent-runtime: [aws-lambda]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.ARTIFACT_BUILD_TESTING_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.ARTIFACT_BUILD_TESTING_AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}
- name: setup-node
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}
cache: yarn
- name: Create example root directory
run: mkdir -p tmp/examples
- name: Create example (${{ matrix.integration }})
env:
WEBHOOK_DIR: tmp/examples/${{ matrix.indent-runtime }}-${{ matrix.integration }}-webhook
INTEGRATION: ${{ matrix.integration }}
run: |
mkdir -p $WEBHOOK_DIR
cp -r templates/example/. $WEBHOOK_DIR && cp -r templates/example/* $WEBHOOK_DIR
mv $WEBHOOK_DIR/package.example.json $WEBHOOK_DIR/package.json
cd templates/scripts && yarn && cd ../../ && \
npx ts-node ./templates/scripts/generate.ts
declare -a INTEGRATION_PKG
case $INTEGRATION in
"okta-auto-approval")
INTEGRATION_PKG="okta"
;;
*)
INTEGRATION_PKG=$INTEGRATION
;;
esac
echo $INTEGRATION_PKG
sed -i "s/\@indent\/integration-example/\@indent\/integration-${INTEGRATION_PKG}/g" $WEBHOOK_DIR/package.json
- name: Setup SSH
uses: webfactory/ssh-agent@ee29fafb6aa450493bac9136b346e51ea60a8b5e
with:
ssh-private-key: ${{ secrets.INDENT_BOT_SSH_PRIVATE_KEY }}
- name: Build example (${{ matrix.integration }})
env:
WEBHOOK_DIR: tmp/examples/${{ matrix.indent-runtime }}-${{ matrix.integration }}-webhook
INTEGRATION: ${{ matrix.integration }}
run: |
cd $WEBHOOK_DIR
yarn build
- name: Set env (ARTIFACT_S3_BUCKET + dev)
if: endsWith(github.ref, '/main') != true
run: |
echo "ARTIFACT_S3_BUCKET=indent-artifacts-us-west-2/dev" >> $GITHUB_ENV
- name: Set env (ARTIFACT_S3_BUCKET)
if: endsWith(github.ref, '/main')
run: |
echo "ARTIFACT_S3_BUCKET=indent-artifacts-us-west-2" >> $GITHUB_ENV
- name: Upload to AWS S3
env:
WEBHOOK_DIR: tmp/examples/${{ matrix.indent-runtime }}-${{ matrix.integration }}-webhook
run: |
cd $WEBHOOK_DIR
aws s3 cp ./dist/layers/layers.zip \
s3://${{ env.ARTIFACT_S3_BUCKET }}/webhooks/aws/lambda/${{ matrix.integration }}-${{ env.INDENT_TAG }}-deps.zip \
--acl public-read
aws s3 cp ./dist/function.zip \
s3://${{ env.ARTIFACT_S3_BUCKET }}/webhooks/aws/lambda/${{ matrix.integration }}-${{ env.INDENT_TAG }}-function.zip \
--acl public-read
- name: Clean example (${{ matrix.integration }})
env:
WEBHOOK_DIR: tmp/examples/${{ matrix.indent-runtime }}-${{ matrix.integration }}-webhook
run: |
cd $WEBHOOK_DIR
yarn clean
rm -rf src && rm -rf scripts && rm *.json
- name: Sync ${{ matrix.integration }} using Copybara
env:
GH_TOKEN: ${{ secrets.IndentBotKey }}
WORKFLOW: ${{ matrix.integration }}
run: |
git config --global user.name "Indent Bot"
git config --global user.email "[email protected]"
echo "https://indent-bot:${GH_TOKEN}@api.github.com" > ~/.git-credentials
echo "Running Copybara..."
GITHUB_REF=. make copybara-${WORKFLOW} COPYBARA_FLAGS="--github-destination-pr-branch copybara-integration-sync $([[ $GITHUB_REF == *"pull"* ]] && echo "--dry-run")" 2>&1 | tee /tmp/copybara-logs
if [[ -n $(</tmp/copybara-logs grep "make: ***" | grep "Error") ]]; then
if [[ -n $(</tmp/copybara-logs grep "Migration of the revision resulted in an empty change") ]]; then
echo "Already up-to-date, skipping..."
exit 0
fi
echo "Encountered error"
exit 2
fi
echo "Copybara ran successfully"