Skip to content

Merge pull request #564 from TheTechCompany/staging #39

Merge pull request #564 from TheTechCompany/staging

Merge pull request #564 from TheTechCompany/staging #39

Workflow file for this run

name: HiveCommand Lambda Infrastructure
on:
push:
branches:
# - staging
- master
paths: ["packages/lambdas/**", "packages/infrastructure/lambdas/**"]
concurrency: hivecommand-lambda-infra-${{ github.ref }}
jobs:
build_reportbot:
runs-on: ubuntu-latest
env:
JWT_SECRET: ${{ secrets.JWT_SECRET }}
steps:
- name: checkout
uses: actions/checkout@v2
- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
# list of Docker images to use as base name for tags
images: |
thetechcompany/hive-command-reportbot
# generate Docker tags based on the following events/attributes
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Setup QEMU
uses: docker/setup-qemu-action@v1
- name: Setup docker buildx
uses: docker/setup-buildx-action@v1
- name: Login to dockerhub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
context: ./
file: ./packages/lambdas/compile-report/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
BUILD_ENV=github
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
push_mqtt_infra:
name: Update Pulumi Infra
runs-on: ubuntu-latest
needs: [build_reportbot]
steps:
- name: checkout
uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16.x
- run: echo "IMAGE_TAG=sha-$(echo $GITHUB_SHA | cut -c1-7)" >> $GITHUB_ENV
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-region: ap-southeast-2
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- run: yarn install --frozen-lockfile
working-directory: ./packages/infrastructure/lambdas
- name: Setup stack
run: |
echo "STACK_NAME=ultraviolet/hivecommand-lambdas/lambdas-prod" >> $GITHUB_ENV
if: ${{ github.ref == 'refs/heads/master' }}
- name: Build export-lambda
run: npx lerna run build --scope @hive-command/schematic-export --include-dependencies
env:
CI: false
- name: Install zip
uses: montudor/action-zip@v1
- name: Zip output
run: zip -qq -r ../../infrastructure/lambdas/src/export-lambda/archive.zip * -x "*/@hive-command/export-page/node_modules/*"
working-directory: packages/lambdas/export-schematic
- name: Update infrastructure
uses: pulumi/actions@v3
if: ${{ github.ref == 'refs/heads/master' }}
with:
command: up
stack-name: ${{env.STACK_NAME}}
work-dir: ./packages/infrastructure/lambdas
env:
PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }}