File tree 5 files changed +32
-9
lines changed
5 files changed +32
-9
lines changed Original file line number Diff line number Diff line change @@ -24,22 +24,21 @@ Create `.github/workflow/deploy.yaml` with the following to build on push.
24
24
``` yaml
25
25
on :
26
26
push :
27
- branches :
28
- - " main"
27
+ branches : [ main ]
29
28
30
29
permissions :
31
30
contents : read
32
- # id-token: write
33
31
34
32
jobs :
35
- deploy :
36
- # environment:
37
- # name: github-pages
38
- # url: ${{ steps.build-publish.outputs.page_url }}
33
+ EC2-Deploy :
39
34
runs-on : ubuntu-latest
35
+ environment :
36
+ name : ${{ github.ref_name }}
37
+ url : ${{ steps.deploy.outputs.vm_url }}
40
38
steps :
41
39
- id : deploy
42
-
40
+ name : Deploy
41
+
43
42
with :
44
43
aws_access_key_id : ${{ secrets.AWS_ACCESS_KEY_ID}}
45
44
aws_secret_access_key : ${{ secrets.AWS_SECRET_ACCESS_KEY}}
52
51
app_port : 3000
53
52
additional_tags : " {\" key1\" : \" value1\" ,\" key2\" : \" value2\" }"
54
53
54
+ - if : ${{ steps.deploy.outputs.vm_url != '' }}
55
+ name : Print result created
56
+ run : |
57
+ echo "## VM Created! :rocket:" >> $GITHUB_STEP_SUMMARY
58
+ echo " ${{ steps.deploy.outputs.vm_url }}" >> $GITHUB_STEP_SUMMARY
59
+ - if : ${{ steps.deploy.outputs.vm_url == '' }}
60
+ name : Print result destroyed
61
+ run : |
62
+ echo "## VM Destroyed! :boom:" >> $GITHUB_STEP_SUMMARY
63
+ echo "Buckets and whole infrastructure should be gone now!" >> $GITHUB_STEP_SUMMARY
55
64
` ` `
56
65
57
66
## Customizing
Original file line number Diff line number Diff line change 67
67
uses : actions/checkout@v3
68
68
69
69
- name : Deploy with BitOps
70
+ id : deploy
70
71
shell : bash
71
72
env :
72
73
GITHUB_ACTION_PATH : ${{ github.action_path }}
91
92
run : |
92
93
echo "running operations/_scripts/deploy/deploy.sh"
93
94
$GITHUB_ACTION_PATH/operations/_scripts/deploy/deploy.sh
95
+ echo "running operations/_scripts/deploy/export_vars.sh"
96
+ $GITHUB_ACTION_PATH/operations/_scripts/deploy/export_vars.sh
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+ # Export variables to GHA
3
+
4
+ cat $GITHUB_ACTION_PATH /operations/bo-out.env >> $GITHUB_OUTPUT
Original file line number Diff line number Diff line change
1
+ resource "local_file" "export-bitops-variables" {
2
+ filename = " /opt/bitops_deployment/bo-out.env"
3
+ content = <<- EOT
4
+ vm_url=${ local . url }
5
+ EOT
6
+ }
Original file line number Diff line number Diff line change @@ -36,5 +36,6 @@ locals {
36
36
}
37
37
38
38
locals {
39
- url = local. fqdn_provided ? " ${ var . sub_domain_name } .${ var . domain_name } " : aws_elb. vm [0 ]. dns_name
39
+ public_port = var. lb_port != " " ? " :${ var . lb_port } " : " "
40
+ url = local. fqdn_provided ? " https://${ var . sub_domain_name } .${ var . domain_name } ${ local . public_port } " : " http://${ aws_elb . vm [0 ]. dns_name } ${ local . public_port } "
40
41
}
You can’t perform that action at this time.
0 commit comments