Skip to content

web

web #111

Workflow file for this run

name: web
on:
push:
branches:
- main
paths:
# Build when there are changes in the directory that holds the component,
# or when this workflow file is changed
- 'web/**'
- '.github/workflows/web.yml'
schedule:
# A weekly build to pick up updates to the base container image
# A weekday at mid-day - when someone is likely to be working (avoid bank holidays)
- cron: "0 12 * * 3"
jobs:
deploy:
name: Lambda
runs-on: ubuntu-latest
env:
component: web
lambdaName: ${{ secrets.WEB_LAMBDA }}
steps:
- uses: actions/checkout@v3
- 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: eu-west-2
- name: Build
working-directory: ./${{ env.component }}
run: |
npm ci
npm run test
npm run compile
- name: Package
working-directory: ./${{ env.component }}
run: |
cp package*.json dist/
cp -r templates dist/
cd dist
npm ci --production
echo $(git rev-parse --short HEAD) > COMMIT_HASH
zip -r function.zip .
- name: Update Lambda
working-directory: ./${{ env.component }}
run: |
aws lambda update-function-code --function-name=${{ env.lambdaName }} --zip-file fileb://dist/function.zip
- name: Notify Slack
if: failure()
uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_USERNAME: Pingmyhouse build
SLACK_COLOR: ${{ job.status }}
SLACK_ICON_EMOJI: ":github_octocat:"
SLACK_CHANNEL: build