-
Notifications
You must be signed in to change notification settings - Fork 3
80 lines (67 loc) · 2.29 KB
/
ingest-api.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
name: Ingest API
permissions:
id-token: write
contents: read
on:
push:
paths:
- .github/workflows/ingest-api.yml
- packages/LocalInfrastructure/**
- packages/IngestAPI/**
env:
WORKING_DIR: ./packages/IngestAPI
jobs:
build:
runs-on: ubuntu-20.04
env:
BATECT_CACHE_TYPE: directory
BATECT_ENABLE_TELEMETRY: false
defaults:
run:
working-directory: ${{ env.WORKING_DIR }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Cache Batect
uses: actions/[email protected]
with:
path: ~/.batect/cache
key: batect-${{ hashFiles(format('{0}/batect', env.WORKING_DIR)) }}
- name: Cache Gradle dependencies
uses: actions/[email protected]
id: cache-packages
with:
path: ${{ env.WORKING_DIR }}/.batect/caches
key: batect-caches-${{ hashFiles(format('{0}/**/*.gradle.kts', env.WORKING_DIR)) }}
- name: Check app
run: ./batect check
- name: Build app
run: ./batect build
- uses: actions/upload-artifact@v3
if: always()
with:
name: reports
path: ${{ env.WORKING_DIR }}/build/reports
- name: Configure AWS credentials
if: ${{ github.actor != 'dependabot[bot]' }}
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: ap-southeast-2
role-to-assume: arn:aws:iam::898449181946:role/allow-auto-deploy-from-other-accounts
role-duration-seconds: 1200
role-session-name: GitHubActions
- name: Login to Amazon ECR
if: ${{ github.actor != 'dependabot[bot]' }}
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Build and push docker image
if: ${{ github.actor != 'dependabot[bot]' }}
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: eop-ingest-api
run: |
echo "$ECR_REGISTRY/$ECR_REPOSITORY:$GITHUB_SHA"
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$GITHUB_SHA .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$GITHUB_SHA