mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-07-12 13:29:04 +00:00
build image
This commit is contained in:
parent
c6a33f3015
commit
7b1ebca790
1 changed files with 34 additions and 15 deletions
49
.github/workflows/deploy_terraform.yml
vendored
49
.github/workflows/deploy_terraform.yml
vendored
|
|
@ -5,18 +5,37 @@ on:
|
||||||
branches:
|
branches:
|
||||||
- "**"
|
- "**"
|
||||||
|
|
||||||
env:
|
|
||||||
AWS_REGION: eu-west-2
|
|
||||||
|
|
||||||
# Temporary until we have more environemnts. You'll just need export STAGE dynamically in the future
|
|
||||||
STAGE: dev
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
determine_stage:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
stage: ${{ steps.set-stage.outputs.stage }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Determine stage from branch
|
||||||
|
id: set-stage
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
BRANCH="${GITHUB_REF_NAME}"
|
||||||
|
|
||||||
|
if [[ "$BRANCH" == "prod" ]]; then
|
||||||
|
echo "stage=prod" >> "$GITHUB_OUTPUT"
|
||||||
|
elif [[ "$BRANCH" == "dev" ]]; then
|
||||||
|
echo "stage=dev" >> "$GITHUB_OUTPUT"
|
||||||
|
else
|
||||||
|
echo "stage=dev" >> "$GITHUB_OUTPUT"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Resolved STAGE=$BRANCH → $(cat $GITHUB_OUTPUT)"
|
||||||
# ============================================================
|
# ============================================================
|
||||||
# 1️⃣ Shared Terraform (plan only for now)
|
# 1️⃣ Shared Terraform (plan only for now)
|
||||||
# ============================================================
|
# ============================================================
|
||||||
shared_terraform:
|
shared_terraform:
|
||||||
|
needs: determine_stage
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
STAGE: ${{ needs.determine_stage.outputs.stage }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
|
|
@ -28,7 +47,7 @@ jobs:
|
||||||
# This will need to be changed to env imports when we have different env to dynamically allocate prod, staging etc
|
# This will need to be changed to env imports when we have different env to dynamically allocate prod, staging etc
|
||||||
aws-access-key-id: ${{ secrets.DEV_AWS_ACCESS_KEY_ID }}
|
aws-access-key-id: ${{ secrets.DEV_AWS_ACCESS_KEY_ID }}
|
||||||
aws-secret-access-key: ${{ secrets.DEV_AWS_SECRET_ACCESS_KEY }}
|
aws-secret-access-key: ${{ secrets.DEV_AWS_SECRET_ACCESS_KEY }}
|
||||||
aws-region: ${{ env.AWS_REGION }}
|
aws-region: ${{ secrets.DEV_AWS_REGION }}
|
||||||
|
|
||||||
- name: Setup Terraform
|
- name: Setup Terraform
|
||||||
uses: hashicorp/setup-terraform@v3
|
uses: hashicorp/setup-terraform@v3
|
||||||
|
|
@ -53,11 +72,11 @@ jobs:
|
||||||
# 2️⃣ Build Docker image (tag = GitHub SHA, digest resolved)
|
# 2️⃣ Build Docker image (tag = GitHub SHA, digest resolved)
|
||||||
# ============================================================
|
# ============================================================
|
||||||
image:
|
image:
|
||||||
|
needs: determine_stage
|
||||||
uses: ./.github/workflows/_build_docker_image.yml
|
uses: ./.github/workflows/_build_docker_image.yml
|
||||||
with:
|
with:
|
||||||
# ecr_repo will need to changed to dynamic env in the future
|
ecr_repo: address2uprn-${{ needs.determine_stage.outputs.stage }}
|
||||||
ecr_repo: address2uprn-dev
|
aws_region: ${{ secrets.DEV_AWS_REGION }}
|
||||||
aws_region: ${{ env.AWS_REGION }}
|
|
||||||
dockerfile_path: backend/address2UPRN/Dockerfile
|
dockerfile_path: backend/address2UPRN/Dockerfile
|
||||||
build_context: backend/address2UPRN
|
build_context: backend/address2UPRN
|
||||||
secrets:
|
secrets:
|
||||||
|
|
@ -65,17 +84,17 @@ jobs:
|
||||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.DEV_AWS_SECRET_ACCESS_KEY }}
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.DEV_AWS_SECRET_ACCESS_KEY }}
|
||||||
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }}
|
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }}
|
||||||
|
|
||||||
# # ============================================================
|
# # # ============================================================
|
||||||
# # 3️⃣ Deploy Lambda (Terraform, immutable digest)
|
# # # 3️⃣ Deploy Lambda (Terraform, immutable digest)
|
||||||
# # ============================================================
|
# # # ============================================================
|
||||||
# deploy_lambda:
|
# deploy_lambda:
|
||||||
# needs: image
|
# needs: [image, determine_stage]
|
||||||
# uses: ./.github/workflows/_deploy_lambda.yml
|
# uses: ./.github/workflows/_deploy_lambda.yml
|
||||||
# with:
|
# with:
|
||||||
# lambda_name: address2uprn
|
# lambda_name: address2uprn
|
||||||
# lambda_path: infrastructure/terraform/lambda/address2uprn
|
# lambda_path: infrastructure/terraform/lambda/address2uprn
|
||||||
# stage: ${{ env.STAGE }}
|
# stage: ${{ needs.determine_stage.outputs.stage }}
|
||||||
# aws_region: ${{ env.AWS_REGION }}
|
# aws_region: ${{ secrets.DEV_AWS_REGION }}
|
||||||
# image_digest: ${{ needs.image.outputs.image_digest }}
|
# image_digest: ${{ needs.image.outputs.image_digest }}
|
||||||
# secrets:
|
# secrets:
|
||||||
# AWS_ACCESS_KEY_ID: ${{ secrets.DEV_AWS_ACCESS_KEY_ID }}
|
# AWS_ACCESS_KEY_ID: ${{ secrets.DEV_AWS_ACCESS_KEY_ID }}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue