Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
Luke-Rogerson committed Mar 15, 2024
1 parent 6d7fb86 commit 50c9ba4
Show file tree
Hide file tree
Showing 2 changed files with 96 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .github/actions/build-push-image/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Build and push Docker image to Heroku
description: Build Docker image for server, swaps tracker and maker mock and push to Heroku Container Registry

inputs:
heroku_api_key:
description: "Heroku API key"
required: true
heroku_app_name:
description: "Heroku app name"
required: true

runs:
using: "composite"
steps:
- name: Login to Heroku Container Registry
shell: bash
run: heroku container:login
env:
HEROKU_API_KEY: ${{ inputs.heroku_api_key }}

- name: Build Docker Image for Server
shell: bash
run: |
docker build --build-arg APP_PATH=./cmd/order-book -t registry.heroku.com/$HEROKU_APP_NAME/web -f cmd/order-book.Dockerfile .
env:
HEROKU_APP_NAME: ${{ inputs.heroku_app_name }}

- name: Push Docker Image for Server to Registry
shell: bash
run: docker push registry.heroku.com/$HEROKU_APP_NAME/web
env:
HEROKU_API_KEY: ${{ inputs.heroku_api_key }}
HEROKU_APP_NAME: ${{ inputs.heroku_app_name }}
63 changes: 63 additions & 0 deletions .github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Build and deploy
env:
terraform_state_s3_bucket: "orbs-terraform-tfstate"
terraform_state_s3_key_prefix: "order-book"
terraform_state_dynamodb_table: "orbs-terraform-locks"
build_path: "."
# on:
# push:
# branches: ["main"]
# paths:
# - "**"
on: push
permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
jobs:
build-server:
runs-on: ubuntu-latest
steps:
- name: Check Out Repo
uses: actions/checkout@v3

- name: Build server image and push to Heroku
uses: ./.github/actions/build-push-image
with:
heroku_api_key: ${{ secrets.HEROKU_API_KEY }}
heroku_app_name: "ob-server-development"

build-swaps-tracker:
runs-on: ubuntu-latest
steps:
- name: Check Out Repo
uses: actions/checkout@v3

- name: Build swaps tracker image and push to Heroku
uses: ./.github/actions/build-push-image
with:
heroku_api_key: ${{ secrets.HEROKU_API_KEY }}
heroku_app_name: "ob-swaps-tracker-development"

build-maker-mock:
runs-on: ubuntu-latest
needs: [build-server, build-swaps-tracker]
steps:
- name: Check Out Repo
uses: actions/checkout@v3

- name: Login to Heroku Container Registry
run: heroku container:login
env:
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}

- name: Build and Push Docker Image
run: |
docker build -t registry.heroku.com/ob-maker-mock/worker -f e2e/maker/Dockerfile .
docker push registry.heroku.com/ob-maker-mock/worker
env:
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}

- name: Release Image
run: heroku container:release worker --app ob-maker-mock
env:
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}

0 comments on commit 50c9ba4

Please sign in to comment.