-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (46 loc) · 1.48 KB
/
deploy-dev.yaml
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
name: Deploy on dev
on:
workflow_dispatch:
inputs:
version:
description: 'App version to deploy'
required: true
default: '1.0.0'
env:
ENVIRONMENT: dev
REGION: eu-central-1
TEAM: Platform-Engineering
jobs:
release:
name: Deploy workoutrecorder-frontend
runs-on: [self-hosted, dev]
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Pull SSH key for Ansible connection
run: |
cd ansible
aws s3 cp \
s3://red-devops-workout-recorder/post-provisioning/app_${{ env.ENVIRONMENT }}_key.pem \
app_${{ env.ENVIRONMENT }}_key.pem
chmod 600 app_${{ env.ENVIRONMENT }}_key.pem
- name: Download artifact
run: |
cd ansible
aws s3 cp \
s3://red-devops-workout-recorder/release/workoutrecorder-frontend-${{ github.event.inputs.version }}.zip \
workoutrecorder-frontend-${{ github.event.inputs.version }}.zip
- name: Ansible Playbook
run: |
cd ansible
ansible-playbook \
deploy.yaml \
-i ./inventories/${{ env.ENVIRONMENT }}/inventory_aws_ec2.yaml \
-extra-vars="app_version=${{ github.event.inputs.version }}" \
--private-key app_${{ env.ENVIRONMENT }}_key.pem
- name: Remove SSH key
if: always()
run: |
cd ansible
rm app_${{ env.ENVIRONMENT }}_key.pem -f
continue-on-error: true