-
Notifications
You must be signed in to change notification settings - Fork 0
95 lines (94 loc) · 2.78 KB
/
development.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
---
# ------------------------------------------------------------------------------
# Build image:
# ghcr.io/dfe-digital/early-years-foundation-recovery:latest
#
# Deploy to:
# https://ey-recovery-dev.london.cloudapps.digital
#
name: Deploy Development App
on:
workflow_dispatch:
push:
branches:
- main
paths-ignore:
- '**/*.md'
- .docker*
- .env.example
- .gitignore
- .pa11yci
- .tool-versions
- .yardopts
- bin/*
- docker-compose.*
- uml/*
jobs:
deploy:
runs-on: ubuntu-latest
environment: development
env:
WORKSPACE: development
REGISTRY: ghcr.io/dfe-digital/early-years-foundation-recovery
steps:
-
name: Checkout Code
uses: actions/checkout@v4
# with:
# ref: ${{ github.sha }}
-
name: Pin Terraform version
uses: hashicorp/setup-terraform@v3
with:
terraform_version: 1.1.7
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
version: v0.9.1
-
name: Login to Github Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Build and push Docker image
uses: docker/build-push-action@v5
with:
target: app
context: .
push: true
build-args: |
BUILDKIT_INLINE_CACHE=1
SHA=${{ github.sha }}
cache-from: |
${{ env.REGISTRY }}:${{ github.sha }}
tags: |
${{ env.REGISTRY }}:${{ github.sha }}
${{ env.REGISTRY }}:latest
-
name: Deploy Development App
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
TF_VAR_paas_cf_user: ${{ secrets.CLOUD_FOUNDRY_USERNAME }}
TF_VAR_paas_cf_password: ${{ secrets.CLOUD_FOUNDRY_PASSWORD }}
TF_VAR_paas_app_docker_image: ${{ env.REGISTRY }}:latest
TF_VAR_paas_app_hostname: dev
TF_VAR_paas_app_env_secrets: ${{ toJson(secrets) }}
TF_VAR_paas_app_envs: ${{ toJson(env) }}
run: |
cd terraform/app
terraform init \
-reconfigure \
-input=false \
-backend-config="bucket=${{ secrets.AWS_BUCKET }}" \
-backend-config="key=${{ env.WORKSPACE }}/terraform.tfstate"
terraform plan \
-var-file ../workspace-variables/${{ env.WORKSPACE }}.tfvars
terraform apply \
-input=false \
-auto-approve \
-var-file ../workspace-variables/${{ env.WORKSPACE }}.tfvars