Skip to content

Commit 4b6abd1

Browse files
committed
feat: add workflows for shared infra and DNS
1 parent 343f429 commit 4b6abd1

2 files changed

Lines changed: 146 additions & 0 deletions

File tree

.github/workflows/shared-dns.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
2+
# This product includes software developed at Datadog (https://www.datadoghq.com/).
3+
# Copyright 2025-Present Datadog, Inc.
4+
5+
name: Shared AWS DNS
6+
7+
on:
8+
push:
9+
branches: ["main"]
10+
pull_request:
11+
branches: ["main"]
12+
paths:
13+
- "shared/dns/aws/**"
14+
- ".github/**"
15+
workflow_dispatch:
16+
inputs:
17+
deploy:
18+
description: "Deploy to AWS dev environment after build"
19+
required: false
20+
default: false
21+
type: boolean
22+
23+
jobs:
24+
deploy-aws-dev:
25+
runs-on: ubuntu-latest
26+
if: |
27+
(github.event_name == 'push' && github.ref == 'refs/heads/main') ||
28+
(github.event_name == 'workflow_dispatch' && inputs.deploy == true)
29+
permissions:
30+
contents: read
31+
packages: write
32+
attestations: write
33+
id-token: write
34+
steps:
35+
- name: Checkout
36+
uses: actions/checkout@v4
37+
- name: Set up Node
38+
uses: actions/setup-node@v3
39+
with:
40+
node-version: "20"
41+
- name: Install CDK
42+
run: |
43+
npm install -g aws-cdk
44+
- name: Install dependencies
45+
shell: bash
46+
run: |
47+
cd shared/lib/shared-constructs
48+
npm i
49+
- name: Configure AWS credentials
50+
uses: aws-actions/configure-aws-credentials@b47578312673ae6fa5b5096b330d9fbac3d116df
51+
with:
52+
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
53+
role-session-name: GitHub_to_AWS_via_FederatedOIDC
54+
aws-region: "eu-west-1"
55+
- name: Set Commit Hash Environment Variables
56+
shell: bash
57+
run: |
58+
echo "sha_short=$(git rev-parse --short "$GITHUB_SHA")" >> "$GITHUB_ENV"
59+
echo "sha_full=$(git rev-parse "$GITHUB_SHA")" >> "$GITHUB_ENV"
60+
- name: Deploy to dev AWS
61+
shell: bash
62+
env:
63+
COMMIT_SHA: ${{ env.sha_short }}
64+
COMMIT_SHA_FULL: ${{ env.sha_full }}
65+
ENV: "dev"
66+
DD_API_KEY: ${{secrets.DD_API_KEY}}
67+
HOSTED_ZONE_ID: ${{secrets.HOSTED_ZONE_ID}}
68+
CERTIFICATE_ARN: ${{secrets.CERTIFICATE_ARN}}
69+
DD_SITE: "datadoghq.com"
70+
run: |
71+
cd shared/dns/aws
72+
npm i
73+
cdk deploy --require-approval never

.github/workflows/shared-infra.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
2+
# This product includes software developed at Datadog (https://www.datadoghq.com/).
3+
# Copyright 2025-Present Datadog, Inc.
4+
5+
name: Shared AWS Infra
6+
7+
on:
8+
push:
9+
branches: ["main"]
10+
pull_request:
11+
branches: ["main"]
12+
paths:
13+
- "shared/infra/aws/**"
14+
- ".github/**"
15+
workflow_dispatch:
16+
inputs:
17+
deploy:
18+
description: "Deploy to AWS dev environment after build"
19+
required: false
20+
default: false
21+
type: boolean
22+
23+
jobs:
24+
deploy-aws-dev:
25+
runs-on: ubuntu-latest
26+
if: |
27+
(github.event_name == 'push' && github.ref == 'refs/heads/main') ||
28+
(github.event_name == 'workflow_dispatch' && inputs.deploy == true)
29+
permissions:
30+
contents: read
31+
packages: write
32+
attestations: write
33+
id-token: write
34+
steps:
35+
- name: Checkout
36+
uses: actions/checkout@v4
37+
- name: Set up Node
38+
uses: actions/setup-node@v3
39+
with:
40+
node-version: "20"
41+
- name: Install CDK
42+
run: |
43+
npm install -g aws-cdk
44+
- name: Install dependencies
45+
shell: bash
46+
run: |
47+
cd shared/lib/shared-constructs
48+
npm i
49+
- name: Configure AWS credentials
50+
uses: aws-actions/configure-aws-credentials@b47578312673ae6fa5b5096b330d9fbac3d116df
51+
with:
52+
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
53+
role-session-name: GitHub_to_AWS_via_FederatedOIDC
54+
aws-region: "eu-west-1"
55+
- name: Set Commit Hash Environment Variables
56+
shell: bash
57+
run: |
58+
echo "sha_short=$(git rev-parse --short "$GITHUB_SHA")" >> "$GITHUB_ENV"
59+
echo "sha_full=$(git rev-parse "$GITHUB_SHA")" >> "$GITHUB_ENV"
60+
- name: Deploy to dev AWS
61+
shell: bash
62+
env:
63+
COMMIT_SHA: ${{ env.sha_short }}
64+
COMMIT_SHA_FULL: ${{ env.sha_full }}
65+
ENV: "dev"
66+
DD_API_KEY: ${{secrets.DD_API_KEY}}
67+
HOSTED_ZONE_ID: ${{secrets.HOSTED_ZONE_ID}}
68+
CERTIFICATE_ARN: ${{secrets.CERTIFICATE_ARN}}
69+
DD_SITE: "datadoghq.com"
70+
run: |
71+
cd shared/infra/aws
72+
npm i
73+
cdk deploy --require-approval never

0 commit comments

Comments
 (0)