67 lines
1.7 KiB
YAML
67 lines
1.7 KiB
YAML
name: Budibase CI
|
|
|
|
on:
|
|
# Trigger the workflow on push or pull request,
|
|
# but only for the master branch
|
|
push:
|
|
branches:
|
|
- master
|
|
pull_request:
|
|
branches:
|
|
- master
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
matrix:
|
|
node-version: [10.x]
|
|
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Use Node.js ${{ matrix.node-version }}
|
|
uses: actions/setup-node@v1
|
|
with:
|
|
node-version: ${{ matrix.node-version }}
|
|
- run: yarn
|
|
- run: yarn lint
|
|
- run: yarn bootstrap
|
|
- run: yarn build
|
|
- run: yarn test
|
|
env:
|
|
CI: true
|
|
name: Budibase CI
|
|
|
|
- name: Login to Amazon ECR
|
|
id: login-ecr
|
|
uses: aws-actions/amazon-ecr-login@v1
|
|
|
|
- name: Build, tag, and push image to Amazon ECR
|
|
id: build-image
|
|
env:
|
|
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
|
|
ECR_REPOSITORY: my-ecr-repo
|
|
IMAGE_TAG: ${{ github.sha }}
|
|
run: |
|
|
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
|
|
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
|
|
echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG"
|
|
|
|
- name: Fill in the new image ID in the Amazon ECS task definition
|
|
id: task-def
|
|
uses: aws-actions/amazon-ecs-render-task-definition@v1
|
|
with:
|
|
task-definition: task-definition.json
|
|
container-name: my-container
|
|
image: ${{ steps.build-image.outputs.image }}
|
|
|
|
- name: Deploy Amazon ECS task definition
|
|
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
|
|
with:
|
|
task-definition: ${{ steps.task-def.outputs.task-definition }}
|
|
service: my-service
|
|
cluster: my-cluster
|
|
wait-for-service-stability: true
|
|
|