Skip to content

Commit cb28997

Browse files
authored
Surface DNS records (#43)
* Fixing full URL output * Adjusted GHA Version * Further fixes. Adjusted README action example to create GH Environment
1 parent d6b35e9 commit cb28997

File tree

5 files changed

+32
-9
lines changed

5 files changed

+32
-9
lines changed

README.md

+17-8
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,21 @@ Create `.github/workflow/deploy.yaml` with the following to build on push.
2424
```yaml
2525
on:
2626
push:
27-
branches:
28-
- "main"
27+
branches: [ main ]
2928

3029
permissions:
3130
contents: read
32-
# id-token: write
3331

3432
jobs:
35-
deploy:
36-
# environment:
37-
# name: github-pages
38-
# url: ${{ steps.build-publish.outputs.page_url }}
33+
EC2-Deploy:
3934
runs-on: ubuntu-latest
35+
environment:
36+
name: ${{ github.ref_name }}
37+
url: ${{ steps.deploy.outputs.vm_url }}
4038
steps:
4139
- id: deploy
42-
uses: bitovi/[email protected]
40+
name: Deploy
41+
uses: bitovi/[email protected]
4342
with:
4443
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID}}
4544
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY}}
@@ -52,6 +51,16 @@ jobs:
5251
app_port: 3000
5352
additional_tags: "{\"key1\": \"value1\",\"key2\": \"value2\"}"
5453

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
5564
```
5665
5766
## Customizing

action.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ runs:
6767
uses: actions/checkout@v3
6868

6969
- name: Deploy with BitOps
70+
id: deploy
7071
shell: bash
7172
env:
7273
GITHUB_ACTION_PATH: ${{ github.action_path }}
@@ -91,3 +92,5 @@ runs:
9192
run: |
9293
echo "running operations/_scripts/deploy/deploy.sh"
9394
$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 numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
# Export variables to GHA
3+
4+
cat $GITHUB_ACTION_PATH/operations/bo-out.env >> $GITHUB_OUTPUT
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
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+
}

operations/deployment/terraform/route53.tf

+2-1
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,6 @@ locals {
3636
}
3737

3838
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}"
4041
}

0 commit comments

Comments
 (0)