feat(notice): add write_challenge_announcement notice #137
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build & Deploy | |
on: | |
pull_request: | |
branches: [ main, master, develop, stage ] | |
types: [ closed ] | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_REGION: ap-southeast-1 | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} | |
ECR_REPOSITORY: lambda-handlers-image | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
jobs: | |
build-and-test: | |
name: Build & Test | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:12-alpine | |
ports: | |
- 5432:5432 | |
env: | |
POSTGRES_DB: matters-test | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
redis: | |
image: redis | |
ports: | |
- 6379:6379 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
cache: 'npm' | |
- run: npm ci | |
- name: Lint | |
run: | | |
npm run lint \ | |
&& npm run format:check | |
- name: Build | |
run: npm run build | |
- name: Test | |
run: npm run test --if-present | |
env: | |
MATTERS_ENV: test | |
MATTERS_PG_HOST: localhost | |
MATTERS_PG_USER: postgres | |
MATTERS_PG_PASSWORD: postgres | |
MATTERS_PG_DATABASE: matters-test | |
MATTERS_NEW_FEATURE_TAG_ID: 1 | |
MATTERS_PG_RO_CONNECTION_STRING: postgresql://postgres:postgres@localhost/matters-test | |
MATTERS_CACHE_HOST: localhost | |
MATTERS_TEST_DB_SETUP: 1 | |
build-and-publish: | |
name: Build Lambda-Handlers Docker Image & Publish to AWS ECR | |
if: github.event.pull_request.merged == true | |
needs: build-and-test | |
runs-on: ubuntu-latest | |
outputs: | |
output1: ${{ steps.step1.outputs.test }} | |
output2: ${{ steps.step2.outputs.test }} | |
registry: ${{ steps.login-ecr.outputs.registry }} | |
image_uri: ${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_REPOSITORY }}:v${{ steps.package-version.outputs.current-version }} | |
package-version: ${{ steps.package-version.outputs.current-version }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: get-npm-version | |
id: package-version | |
uses: martinbeentjes/npm-get-version-action@main | |
- name: Setup AWS | |
# if: github.base_ref == 'develop' || github.base_ref == 'stage' || github.base_ref == 'master' || github.base_ref == 'main' | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ${{ env.AWS_REGION }} | |
- name: Login to Amazon ECR | |
# if: github.base_ref == 'develop' || github.base_ref == 'stage' || github.base_ref == 'master' || github.base_ref == 'main' | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v1 | |
- name: Build, tag, and push image to Amazon ECR | |
if: github.base_ref == 'main' | |
run: | | |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG -f Dockerfile . | |
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG | |
env: | |
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} | |
IMAGE_TAG: v${{ steps.package-version.outputs.current-version }} | |
IMAGE_URI: ${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_REPOSITORY }}:v${{ steps.package-version.outputs.current-version }} | |
deploy-check-motor-dev: | |
runs-on: 'ubuntu-latest' | |
environment: 'dev' | |
needs: build-and-publish | |
steps: | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v1 | |
- name: re-deploy Check Motor Lambda to dev | |
run: | | |
aws lambda update-function-code --function-name check-motor-badge-dev \ | |
--image-uri ${{ steps.login-ecr.outputs.registry }}/$ECR_REPOSITORY:$IMAGE_TAG | |
env: | |
IMAGE_URI: ${{ needs.build-and-publish.outputs.image_uri }} | |
IMAGE_TAG: v${{ needs.build-and-publish.outputs.package-version }} | |
deploy-check-motor-prod: | |
runs-on: 'ubuntu-latest' | |
environment: 'prod' | |
needs: [build-and-publish, deploy-check-motor-dev] | |
steps: | |
- name: re-deploy Check Motor Lambda | |
run: echo call lambda re-deploy check-motor-prod | |
check-motor-dev-running: | |
runs-on: 'ubuntu-latest' | |
environment: 'dev' | |
needs: [build-and-publish, deploy-check-motor-dev] | |
steps: | |
- name: Check if Motor Lambda running well on dev | |
run: echo Invoke AWS Lambda check-motor-dev running well && env | |
check-motor-prod-running: | |
runs-on: 'ubuntu-latest' | |
environment: 'dev' | |
needs: [build-and-publish, deploy-check-motor-prod] | |
steps: | |
- name: Check if Motor Lambda running well on prod | |
run: echo Invoke AWS Lambda if check-motor-prod running well && env | |
### User Retention | |
deploy-user-retention-dev: | |
runs-on: 'ubuntu-latest' | |
environment: 'dev' | |
needs: build-and-publish | |
steps: | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v1 | |
- name: re-deploy User Retention Lambda to dev | |
run: | | |
aws lambda update-function-code --function-name user-retention-dev \ | |
--image-uri ${{ steps.login-ecr.outputs.registry }}/$ECR_REPOSITORY:$IMAGE_TAG | |
env: | |
IMAGE_TAG: v${{ needs.build-and-publish.outputs.package-version }} | |
deploy-user-retention-sendmail-dev: | |
runs-on: 'ubuntu-latest' | |
environment: 'dev' | |
needs: build-and-publish | |
steps: | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v1 | |
- name: re-deploy User Retention Lambda to dev | |
run: | | |
aws lambda update-function-code --function-name user-retention-sendmail-dev \ | |
--image-uri ${{ steps.login-ecr.outputs.registry }}/$ECR_REPOSITORY:$IMAGE_TAG | |
env: | |
IMAGE_TAG: v${{ needs.build-and-publish.outputs.package-version }} | |
### User Likecoin | |
deploy-likecoin-like-dev: | |
runs-on: 'ubuntu-latest' | |
environment: 'dev' | |
needs: build-and-publish | |
steps: | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v1 | |
- name: re-deploy Likecoin Like Lambda to dev | |
run: | | |
aws lambda update-function-code --function-name likecoin-like-dev \ | |
--image-uri ${{ steps.login-ecr.outputs.registry }}/$ECR_REPOSITORY:$IMAGE_TAG | |
env: | |
IMAGE_TAG: v${{ needs.build-and-publish.outputs.package-version }} | |
deploy-likecoin-update-civic-liker-cache-dev: | |
runs-on: 'ubuntu-latest' | |
environment: 'dev' | |
needs: build-and-publish | |
steps: | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v1 | |
- name: re-deploy Likecoin likecoin-update-civic-liker-cache Lambda to dev | |
run: | | |
aws lambda update-function-code --function-name likecoin-update-civic-liker-cache-dev \ | |
--image-uri ${{ steps.login-ecr.outputs.registry }}/$ECR_REPOSITORY:$IMAGE_TAG | |
env: | |
IMAGE_TAG: v${{ needs.build-and-publish.outputs.package-version }} | |
deploy-likecoin-batch-update-civic-liker-caches-dev: | |
runs-on: 'ubuntu-latest' | |
environment: 'dev' | |
needs: build-and-publish | |
steps: | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v1 | |
- name: re-deploy Lambda to dev | |
run: | | |
aws lambda update-function-code --function-name likecoin-batch-update-civic-liker-caches-dev \ | |
--image-uri ${{ steps.login-ecr.outputs.registry }}/$ECR_REPOSITORY:$IMAGE_TAG | |
env: | |
IMAGE_TAG: v${{ needs.build-and-publish.outputs.package-version }} | |
deploy-archive-user-dev: | |
runs-on: 'ubuntu-latest' | |
environment: 'dev' | |
needs: build-and-publish | |
steps: | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v1 | |
- name: re-deploy Lambda to dev | |
run: | | |
aws lambda update-function-code --function-name archive-user-dev \ | |
--image-uri ${{ steps.login-ecr.outputs.registry }}/$ECR_REPOSITORY:$IMAGE_TAG | |
env: | |
IMAGE_TAG: v${{ needs.build-and-publish.outputs.package-version }} | |
deploy-articles-indexer-dev: | |
runs-on: 'ubuntu-latest' | |
environment: 'dev' | |
needs: build-and-publish | |
steps: | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v1 | |
- name: re-deploy Lambda to dev | |
run: | | |
aws lambda update-function-code --function-name articles-indexer-dev \ | |
--image-uri ${{ steps.login-ecr.outputs.registry }}/$ECR_REPOSITORY:$IMAGE_TAG | |
env: | |
IMAGE_TAG: v${{ needs.build-and-publish.outputs.package-version }} | |
deploy-daily-summary-email-dev: | |
runs-on: 'ubuntu-latest' | |
environment: 'dev' | |
needs: build-and-publish | |
steps: | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v1 | |
- name: re-deploy Lambda to dev | |
run: | | |
aws lambda update-function-code --function-name daily-summary-email-dev \ | |
--image-uri ${{ steps.login-ecr.outputs.registry }}/$ECR_REPOSITORY:$IMAGE_TAG | |
env: | |
IMAGE_TAG: v${{ needs.build-and-publish.outputs.package-version }} | |
deploy-billboard-clear-auction-and-distribute-tax-dev: | |
runs-on: 'ubuntu-latest' | |
environment: 'dev' | |
needs: build-and-publish | |
steps: | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v1 | |
- name: re-deploy Lambda to dev | |
run: | | |
aws lambda update-function-code --function-name billboard-clear-auction-and-distribute-tax-dev \ | |
--image-uri ${{ steps.login-ecr.outputs.registry }}/$ECR_REPOSITORY:$IMAGE_TAG | |
env: | |
IMAGE_TAG: v${{ needs.build-and-publish.outputs.package-version }} | |
deploy-check-nomad-badge-dev: | |
runs-on: 'ubuntu-latest' | |
environment: 'dev' | |
needs: build-and-publish | |
steps: | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v1 | |
- name: re-deploy Lambda to dev | |
run: | | |
aws lambda update-function-code --function-name check-nomad-badge-dev \ | |
--image-uri ${{ steps.login-ecr.outputs.registry }}/$ECR_REPOSITORY:$IMAGE_TAG | |
env: | |
IMAGE_TAG: v${{ needs.build-and-publish.outputs.package-version }} | |
deploy-exchange-rate-dev: | |
runs-on: 'ubuntu-latest' | |
environment: 'dev' | |
needs: build-and-publish | |
steps: | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v1 | |
- name: re-deploy Lambda to dev | |
run: | | |
aws lambda update-function-code --function-name exchange-rate-dev \ | |
--image-uri ${{ steps.login-ecr.outputs.registry }}/$ECR_REPOSITORY:$IMAGE_TAG | |
env: | |
IMAGE_TAG: v${{ needs.build-and-publish.outputs.package-version }} | |
deploy-payment-cancel-timeout-transactions-dev: | |
runs-on: 'ubuntu-latest' | |
environment: 'dev' | |
needs: build-and-publish | |
steps: | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v1 | |
- name: re-deploy Lambda to dev | |
run: | | |
aws lambda update-function-code --function-name payment-cancel-timeout-transactions-dev \ | |
--image-uri ${{ steps.login-ecr.outputs.registry }}/$ECR_REPOSITORY:$IMAGE_TAG | |
env: | |
IMAGE_TAG: v${{ needs.build-and-publish.outputs.package-version }} | |
deploy-qf-calculator-dev: | |
runs-on: 'ubuntu-latest' | |
environment: 'dev' | |
needs: build-and-publish | |
steps: | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v1 | |
- name: re-deploy Lambda to dev | |
run: | | |
aws lambda update-function-code --function-name qf-calculator-dev \ | |
--image-uri ${{ steps.login-ecr.outputs.registry }}/$ECR_REPOSITORY:$IMAGE_TAG | |
env: | |
IMAGE_TAG: v${{ needs.build-and-publish.outputs.package-version }} | |
deploy-refresh-ipns-gw3-dev: | |
runs-on: 'ubuntu-latest' | |
environment: 'dev' | |
needs: build-and-publish | |
steps: | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v1 | |
- name: re-deploy Lambda to dev | |
run: | | |
aws lambda update-function-code --function-name refresh-ipns-gw3-dev \ | |
--image-uri ${{ steps.login-ecr.outputs.registry }}/$ECR_REPOSITORY:$IMAGE_TAG | |
env: | |
IMAGE_TAG: v${{ needs.build-and-publish.outputs.package-version }} | |
deploy-refresh-search-index-dev: | |
runs-on: 'ubuntu-latest' | |
environment: 'dev' | |
needs: build-and-publish | |
steps: | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v1 | |
- name: re-deploy Lambda to dev | |
run: | | |
aws lambda update-function-code --function-name refresh-search-index-dev \ | |
--image-uri ${{ steps.login-ecr.outputs.registry }}/$ECR_REPOSITORY:$IMAGE_TAG | |
env: | |
IMAGE_TAG: v${{ needs.build-and-publish.outputs.package-version }} | |
deploy-refresh-view-dev: | |
runs-on: 'ubuntu-latest' | |
environment: 'dev' | |
needs: build-and-publish | |
steps: | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v1 | |
- name: re-deploy Lambda to dev | |
run: | | |
aws lambda update-function-code --function-name refresh-view-dev \ | |
--image-uri ${{ steps.login-ecr.outputs.registry }}/$ECR_REPOSITORY:$IMAGE_TAG | |
env: | |
IMAGE_TAG: v${{ needs.build-and-publish.outputs.package-version }} | |
deploy-sendmail-dev: | |
runs-on: 'ubuntu-latest' | |
environment: 'dev' | |
needs: build-and-publish | |
steps: | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v1 | |
- name: re-deploy Lambda to dev | |
run: | | |
aws lambda update-function-code --function-name sendmail-dev \ | |
--image-uri ${{ steps.login-ecr.outputs.registry }}/$ECR_REPOSITORY:$IMAGE_TAG | |
env: | |
IMAGE_TAG: v${{ needs.build-and-publish.outputs.package-version }} | |
deploy-sync-audit-log-to-bigquery-dev: | |
runs-on: 'ubuntu-latest' | |
environment: 'dev' | |
needs: build-and-publish | |
steps: | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v1 | |
- name: re-deploy Lambda to dev | |
run: | | |
aws lambda update-function-code --function-name sync-audit-log-to-bigquery-dev \ | |
--image-uri ${{ steps.login-ecr.outputs.registry }}/$ECR_REPOSITORY:$IMAGE_TAG | |
env: | |
IMAGE_TAG: v${{ needs.build-and-publish.outputs.package-version }} | |
deploy-sync-stripe-delivery-failed-events-dev: | |
runs-on: 'ubuntu-latest' | |
environment: 'dev' | |
needs: build-and-publish | |
steps: | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v1 | |
- name: re-deploy Lambda to dev | |
run: | | |
aws lambda update-function-code --function-name sync-stripe-delivery-failed-events-dev \ | |
--image-uri ${{ steps.login-ecr.outputs.registry }}/$ECR_REPOSITORY:$IMAGE_TAG | |
env: | |
IMAGE_TAG: v${{ needs.build-and-publish.outputs.package-version }} | |
deploy-transfer-trial-end-subscriptions-dev: | |
runs-on: 'ubuntu-latest' | |
environment: 'dev' | |
needs: build-and-publish | |
steps: | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v1 | |
- name: re-deploy Lambda to dev | |
run: | | |
aws lambda update-function-code --function-name transfer-trial-end-subscriptions-dev \ | |
--image-uri ${{ steps.login-ecr.outputs.registry }}/$ECR_REPOSITORY:$IMAGE_TAG | |
env: | |
IMAGE_TAG: v${{ needs.build-and-publish.outputs.package-version }} |