Skip to content

Migrate build to GitHub actions #11

Migrate build to GitHub actions

Migrate build to GitHub actions #11

Workflow file for this run

name: Build
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
# allow queued workflows to interrupt previous runs
concurrency:
group: ${{ github.workflow }}-${{ github.event.number || github.ref }}
cancel-in-progress: true
permissions:
id-token: write
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: corretto
cache: sbt
java-version: 11
- uses: actions/setup-node@v3
with:
cache: npm
cache-dependency-path: cdk/package-lock.json
node-version-file: .nvmrc
- uses: aws-actions/configure-aws-credentials@v2
with:
aws-region: eu-west-1
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
# - name: Login to ECR
# uses: aws-actions/amazon-ecr-login@v1
# with:
# mask-password: 'true'
- name: Compile and test
run: sbt compile test
- name: Build docker image
run: sbt docker:publishLocal
- name: Publish docker image
run: |
echo $BUILD_NUMBER
docker images
docker tag notificationworkerlambda:DEV $NOTIFICATION_LAMBDA_REPOSITORY_URL:$BUILD_NUMBER
docker images
./deploy.sh
env:
NOTIFICATION_LAMBDA_REPOSITORY_ID: ${{ secrets.NOTIFICATION_LAMBDA_REPOSITORY_ID }}
NOTIFICATION_LAMBDA_REPOSITORY_URL: ${{ secrets.NOTIFICATION_LAMBDA_REPOSITORY_URL }}
BUILD_NUMBER: ${{ github.run_number }}
- name: Cdk synth
run: |
set -e
if [ -e cdk/ ]
then
echo "CDK detected"
source ~/.nvm/nvm.sh
nvm install
nvm use
(
echo "Running CDK CI steps"
cd cdk
npm ci
npm run lint
npm test
npm run synth
)
else
echo "No CDK - skipping"
fi
- uses: aws-actions/configure-aws-credentials@v2
with:
aws-region: eu-west-1
role-to-assume: ${{ secrets.GU_RIFF_RAFF_ROLE_ARN }}
- name: Upload eventconsumer to riff-raff
uses: guardian/actions-riff-raff@v2
with:
projectName: mobile-n10n:eventconsumer
# buildNumberOffset: 172
configPath: eventconsumer/riff-raff.yaml
contentDirectories: |
eventconsumer:
- eventconsumer/target/scala-2.13/eventconsumer.jar
mobile-notifications-eventconsumer-cfn:
- cfn.yaml
# - name: Upload fakebreakingnewslambda to riff-raff
# uses: guardian/actions-riff-raff@v2
# with:
# projectName: mobile-n10n
## buildNumberOffset: 172
# configPath: riff-raff.yaml
# contentDirectories: |
# live-app-versions:
# - target/scala-2.12/live-app-versions.jar
# live-app-versions-cfn:
# - cfn.yaml
#
# - name: Upload football to riff-raff
# uses: guardian/actions-riff-raff@v2
# with:
# projectName: mobile-n10n
## buildNumberOffset: 172
# configPath: riff-raff.yaml
# contentDirectories: |
# live-app-versions:
# - target/scala-2.12/live-app-versions.jar
# live-app-versions-cfn:
# - cfn.yaml
#
# - name: Upload notification to riff-raff
# uses: guardian/actions-riff-raff@v2
# with:
# projectName: mobile-n10n
## buildNumberOffset: 172
# configPath: riff-raff.yaml
# contentDirectories: |
# live-app-versions:
# - target/scala-2.12/live-app-versions.jar
# live-app-versions-cfn:
# - cfn.yaml
#
# - name: Upload registration to riff-raff
# uses: guardian/actions-riff-raff@v2
# with:
# projectName: mobile-n10n
## buildNumberOffset: 172
# configPath: riff-raff.yaml
# contentDirectories: |
# live-app-versions:
# - target/scala-2.12/live-app-versions.jar
# live-app-versions-cfn:
# - cfn.yaml
#
# - name: Upload report to riff-raff
# uses: guardian/actions-riff-raff@v2
# with:
# projectName: mobile-n10n
## buildNumberOffset: 172
# configPath: riff-raff.yaml
# contentDirectories: |
# live-app-versions:
# - target/scala-2.12/live-app-versions.jar
# live-app-versions-cfn:
# - cfn.yaml
#
# - name: Upload reportextractor to riff-raff
# uses: guardian/actions-riff-raff@v2
# with:
# projectName: mobile-n10n
## buildNumberOffset: 172
# configPath: riff-raff.yaml
# contentDirectories: |
# live-app-versions:
# - target/scala-2.12/live-app-versions.jar
# live-app-versions-cfn:
# - cfn.yaml
#
# - name: Upload schedule to riff-raff
# uses: guardian/actions-riff-raff@v2
# with:
# projectName: mobile-n10n
## buildNumberOffset: 172
# configPath: riff-raff.yaml
# contentDirectories: |
# live-app-versions:
# - target/scala-2.12/live-app-versions.jar
# live-app-versions-cfn:
# - cfn.yaml
#
# - name: Upload slomonitor to riff-raff
# uses: guardian/actions-riff-raff@v2
# with:
# projectName: mobile-n10n
## buildNumberOffset: 172
# configPath: riff-raff.yaml
# contentDirectories: |
# live-app-versions:
# - target/scala-2.12/live-app-versions.jar
# live-app-versions-cfn:
# - cfn.yaml