-
Notifications
You must be signed in to change notification settings - Fork 0
/
maintenance-page.yml
40 lines (38 loc) · 1.3 KB
/
maintenance-page.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
name: Deploy Maintenance Page
on:
workflow_dispatch:
inputs:
maintenanceMessage:
description: "Set the maintenance message"
required: true
default: "You will be able to use the service soon"
jobs:
deploy:
name: Deploy Maintenance Page
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
environment: production
defaults:
run:
working-directory: maintenance-page
env:
TF_WORKSPACE: production
steps:
- uses: actions/checkout@v2.3.4
- uses: hashicorp/setup-terraform@v1.3.2
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1.5.9
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: Initialize Terraform
run: terraform init
- name: Validate Terraform
run: terraform validate
- name: Create resources
run: terraform apply -auto-approve -var-file=production.tfvars
- name: Set Message
run: sed -i 's/${ maintenanceMessage }/${{ github.event.inputs.maintenanceMessage }}/g' html/index.html
- name: Deploy app build to S3 bucket
run: aws s3 sync ./html/ s3://myservice.com --delete