-
Notifications
You must be signed in to change notification settings - Fork 0
88 lines (74 loc) · 2.97 KB
/
build.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
81
82
83
84
85
86
87
88
name: build
on:
push:
branches: ["main"]
pull_request:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
permissions: # required by aws-actions/configure-aws-credentials
id-token: write
contents: read
checks: write
steps:
- uses: actions/checkout@v3
- name: Setup JDK and sbt
uses: guardian/setup-scala@v1
- name: Build and Test project, Assemble jar, copy to root dir
run: |
sbt compile test assembly
cp target/scala*/mobile-notifications-content.jar .
- uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: eu-west-1
role-to-assume: ${{ secrets.AWS_ECR_ROLE }}
- name: Login to ECR
uses: aws-actions/amazon-ecr-login@v2
with:
mask-password: 'true'
- name: Build and publish docker image for content
run: |
BUILD_NUMBER_WITH_OFFSET=$(($BUILD_NUMBER+466))
docker build -f mobile-notifications-content.Dockerfile --platform linux/amd64 -t mobile-notifications-content:dev .
docker tag mobile-notifications-content:dev $NOTIFICATION_CONTENT_LAMBDA_REPOSITORY_URL:$BUILD_NUMBER_WITH_OFFSET
docker push ${NOTIFICATION_CONTENT_LAMBDA_REPOSITORY_URL}:${BUILD_NUMBER_WITH_OFFSET}
env:
NOTIFICATION_CONTENT_LAMBDA_REPOSITORY_URL: ${{ secrets.NOTIFICATION_CONTENT_LAMBDA_REPOSITORY_URL }}
BUILD_NUMBER: ${{ github.run_number }}
- name: Build and publish docker image for liveblogs
run: |
BUILD_NUMBER_WITH_OFFSET=$(($BUILD_NUMBER+466))
docker build -f mobile-notifications-liveblogs.Dockerfile --platform linux/amd64 -t mobile-notifications-liveblogs:dev .
docker tag mobile-notifications-liveblogs:dev $NOTIFICATION_LIVEBLOGS_LAMBDA_REPOSITORY_URL:$BUILD_NUMBER_WITH_OFFSET
docker push ${NOTIFICATION_LIVEBLOGS_LAMBDA_REPOSITORY_URL}:${BUILD_NUMBER_WITH_OFFSET}
env:
NOTIFICATION_LIVEBLOGS_LAMBDA_REPOSITORY_URL: ${{ secrets.NOTIFICATION_LIVEBLOGS_LAMBDA_REPOSITORY_URL }}
BUILD_NUMBER: ${{ github.run_number }}
- uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: eu-west-1
role-to-assume: ${{ secrets.GU_RIFF_RAFF_ROLE_ARN }}
- name: Test Report
uses: dorny/test-reporter@v1
if: success() || failure() # run this step even if previous step failed
with:
name: Tests
path: target/test-reports/TEST-*.xml
reporter: java-junit
only-summary: 'false'
fail-on-error: 'true'
- name: AWS Auth
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: ${{ secrets.GU_RIFF_RAFF_ROLE_ARN }}
aws-region: eu-west-1
- name: Upload to riff-raff
uses: guardian/actions-riff-raff@v2
with:
configPath: riff-raff.yaml
projectName: Mobile::mobile-notifications-content
buildNumberOffset: 466
contentDirectories: |
mobile-notifications-content-cfn:
- cfn.yaml