Add setup scala (#105) #268
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 | |
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 |