Skip to content

Commit 3148f81

Browse files
committed
feat: add CI workflow for integration testing and deployment with environment tagging
1 parent 2204de1 commit 3148f81

2 files changed

Lines changed: 80 additions & 0 deletions

File tree

.github/workflows/tester-tag.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: ci
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
environment:
7+
description: "Target environment tag value"
8+
required: true
9+
default: staging
10+
type: choice
11+
options: [staging, production]
12+
push:
13+
branches:
14+
- develop
15+
16+
env:
17+
MINIMUM_PACKAGE_AGE_HOURS: 0
18+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
19+
SAFE_CHAIN_VERSION: "1.4.7"
20+
SAFE_CHAIN_SHA256: "54c750232d149106ecf4f5f28fee82ba49d2428f1e411e0ed961c0263ae19eaf"
21+
22+
permissions:
23+
id-token: write
24+
contents: read
25+
26+
jobs:
27+
test:
28+
name: Integration test
29+
runs-on: ubuntu-latest
30+
31+
steps:
32+
- name: Checkout
33+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
34+
35+
- name: Setup Bun
36+
uses: oven-sh/setup-bun@735343b667d3e6f658f44d0eca948eb6282f2b76 # v2.0.2
37+
38+
- name: Install safe-chain
39+
run: |
40+
curl -fsSL "https://github.com/AikidoSec/safe-chain/releases/download/${SAFE_CHAIN_VERSION}/install-safe-chain.sh" \
41+
-o install-safe-chain.sh
42+
echo "${SAFE_CHAIN_SHA256} install-safe-chain.sh" | sha256sum --check
43+
sh install-safe-chain.sh --ci
44+
45+
- name: Install dependencies
46+
run: bun install
47+
env:
48+
SAFE_CHAIN_MINIMUM_PACKAGE_AGE_HOURS: ${{ env.MINIMUM_PACKAGE_AGE_HOURS }}
49+
50+
- name: Configure AWS credentials (OIDC)
51+
uses: aws-actions/configure-aws-credentials@ec61189d14ec14c8efccab744f656cffd0e33f37 # v6.1.0
52+
with:
53+
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
54+
aws-region: ${{ secrets.AWS_REGION }}
55+
56+
- name: Deploy to ${{ inputs.environment || 'production' }}
57+
id: deploy
58+
uses: ./
59+
with:
60+
aws-region: us-east-1
61+
# Targets all instances tagged env=<environment> AND role=web
62+
targets: |
63+
Key=tag:env,Values=${{ inputs.environment || 'production' }}
64+
Key=tag:role,Values=web
65+
working-directory: /home/ec2-user
66+
wait-for-output: true
67+
wait-timeout: 180
68+
comment: Deploy ${{ github.sha }} to ${{ inputs.environment || 'production' }}
69+
command: |
70+
echo `date +%Y-%m-%dT%H:%M:%S%z` "Hello from tester-tag.yml" >> logs.txt
71+
cat logs.txt
72+
73+
- name: Print output
74+
run: echo "${{ steps.deploy.outputs.output }}"

.github/workflows/tester.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,19 @@ jobs:
4747
aws-region: ${{ secrets.AWS_REGION }}
4848

4949
- name: Run SSM command
50+
id: deploy
5051
uses: ./
5152
with:
5253
aws-region: ${{ secrets.AWS_REGION }}
5354
instance-ids: ${{ secrets.INSTANCE_ID }}
55+
wait-for-output: true
56+
wait-timeout: 180
5457
working-directory: /home/ec2-user
5558
comment: aws-ssm-action CI test
5659
command: |
5760
echo "Hello from GitHub Actions!" >> logs.txt
5861
echo $(date) >> logs.txt
5962
cat logs.txt
63+
64+
- name: Print output
65+
run: echo "${{ steps.deploy.outputs.output }}"

0 commit comments

Comments
 (0)