Skip to content

Commit 1383c35

Browse files
initial commit
1 parent d3d7548 commit 1383c35

54 files changed

Lines changed: 49463 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.eslintignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.vscode/*
2+
coverage/*
3+
scripts/*

.eslintrc.cjs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* Copyright 2021 Adobe. All rights reserved.
3+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
4+
* you may not use this file except in compliance with the License. You may obtain a copy
5+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
6+
*
7+
* Unless required by applicable law or agreed to in writing, software distributed under
8+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9+
* OF ANY KIND, either express or implied. See the License for the specific language
10+
* governing permissions and limitations under the License.
11+
*/
12+
13+
module.exports = {
14+
root: true,
15+
parser: '@typescript-eslint/parser',
16+
parserOptions: {
17+
ecmaVersion: 2020,
18+
sourceType: 'module',
19+
},
20+
extends: [
21+
'@adobe/helix',
22+
'plugin:@typescript-eslint/recommended',
23+
],
24+
plugins: [
25+
'import',
26+
'@typescript-eslint',
27+
],
28+
overrides: [
29+
{
30+
files: ['*.test.js'],
31+
rules: {
32+
'@typescript-eslint/no-unused-expressions': 'off',
33+
},
34+
},
35+
],
36+
};
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
labels: bug
5+
6+
---
7+
8+
**Description**
9+
A clear and concise description of what the bug is.
10+
11+
**To Reproduce**
12+
Steps to reproduce the behavior:
13+
1. Go to '...'
14+
2. Click on '....'
15+
3. Scroll down to '....'
16+
4. See error
17+
18+
**Expected behavior**
19+
A clear and concise description of what you expected to happen.
20+
21+
**Screenshots**
22+
If applicable, add screenshots to help explain your problem.
23+
24+
**Version:**
25+
run: `$ hlx --version`
26+
27+
**Additional context**
28+
Add any other context about the problem here.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
name: Discussion
3+
about: Start a new discussion
4+
labels: question
5+
6+
---
7+
8+
## Overview
9+
whats' this discussion about?
10+
11+
## Details
12+
more details
13+
14+
## Proposed Actions
15+
and now?
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
labels: enhancement
5+
6+
---
7+
8+
**Is your feature request related to a problem? Please describe.**
9+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
10+
11+
**Describe the solution you'd like**
12+
A clear and concise description of what you want to happen.
13+
14+
**Describe alternatives you've considered**
15+
A clear and concise description of any alternative solutions or features you've considered.
16+
17+
**Additional context**
18+
Add any other context or screenshots about the feature request here.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: "Set up AWS Credentials and Fetch Secrets"
2+
description: "Configures AWS credentials for use in subsequent steps. Fetches secrets from AWS Secrets Manager."
3+
4+
inputs:
5+
aws_role_to_assume:
6+
description: "ARN of the IAM role to assume"
7+
default: "arn:aws:iam::682033462621:role/spacecat-role-github-actions"
8+
required: true
9+
secret_ids:
10+
description: "List of secret IDs to fetch from AWS Secrets Manager"
11+
default: |
12+
/spacecat/github-actions
13+
required: true
14+
15+
runs:
16+
using: "composite"
17+
steps:
18+
- name: Configure AWS Credentials
19+
id: creds
20+
uses: aws-actions/configure-aws-credentials@v4
21+
with:
22+
aws-region: us-east-1
23+
role-to-assume: ${{ inputs.aws_role_to_assume }}
24+
25+
- name: Fetch AWS Secrets
26+
uses: aws-actions/aws-secretsmanager-get-secrets@v2
27+
with:
28+
parse-json-secrets: true
29+
secret-ids: ${{ inputs.secret_ids }}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: "Lint, Test, and Coverage"
2+
description: "Runs lint and test commands, plus coverage"
3+
4+
inputs:
5+
codecov_token:
6+
description: "Codecov Token (optional)"
7+
required: false
8+
default: ""
9+
upload_coverage:
10+
description: "Whether to upload coverage to Codecov (true/false). Default false."
11+
required: false
12+
default: "false"
13+
14+
runs:
15+
using: "composite"
16+
steps:
17+
- name: Lint
18+
run: npm run lint
19+
shell: bash
20+
21+
- name: Test
22+
run: npm run test
23+
shell: bash
24+
25+
- name: Upload coverage to Codecov
26+
if: ${{ inputs.upload_coverage == 'true' }}
27+
uses: codecov/codecov-action@v5
28+
with:
29+
token: ${{ inputs.codecov_token }}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: "Setup Node & NPM (with cache)"
2+
description: "Checks out code, sets up Node, uses NPM cache, installs dependencies"
3+
4+
runs:
5+
using: "composite"
6+
steps:
7+
- name: Set up Node
8+
uses: actions/setup-node@v4
9+
with:
10+
node-version: 22.12
11+
12+
- name: Get npm cache directory
13+
id: npm-cache-dir
14+
run: echo "dir=$(npm config get cache)" >> $GITHUB_OUTPUT
15+
shell: bash
16+
17+
- name: Set up NPM Cache
18+
uses: actions/cache@v4
19+
id: npm-cache
20+
with:
21+
path: ${{ steps.npm-cache-dir.outputs.dir }}
22+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
23+
restore-keys: |
24+
${{ runner.os }}-node-
25+
26+
- name: Update NPM (only if cache miss)
27+
run: npm install -g npm@10.9.2
28+
shell: bash
29+
30+
- name: Install dependencies (only if cache miss)
31+
run: npm ci
32+
shell: bash

.github/pull_request_template.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Please ensure your pull request adheres to the following guidelines:
2+
- [ ] make sure to link the related issues in this description
3+
- [ ] when merging / squashing, make sure the fixed issue references are visible in the commits, for easy compilation of release notes
4+
5+
## Related Issues
6+
7+
8+
Thanks for contributing!

.github/workflows/ci.yaml

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
name: Build
2+
3+
permissions:
4+
id-token: write
5+
contents: write
6+
issues: read
7+
8+
on: [push]
9+
10+
env:
11+
CI_BUILD_NUM: ${{ github.run_id }}
12+
CI_BRANCH: ${{ github.ref_name }}
13+
HLX_AWS_REGION: ${{ secrets.AWS_REGION }}
14+
jobs:
15+
build:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Check out
19+
uses: actions/checkout@v4
20+
with:
21+
persist-credentials: 'false'
22+
- name: Setup Node & NPM
23+
uses: ./.github/actions/setup-node-npm
24+
25+
- name: Lint, Test, Coverage Upload
26+
uses: ./.github/actions/lint-test-coverage
27+
with:
28+
upload_coverage: "true"
29+
codecov_token: ${{ secrets.CODECOV_TOKEN }}
30+
31+
- name: Semantic Release (Dry Run)
32+
if: github.ref != 'refs/heads/main'
33+
run: npm run semantic-release-dry
34+
env:
35+
GITHUB_TOKEN: ${{ secrets.ADOBE_BOT_GITHUB_TOKEN }}
36+
NPM_TOKEN: ${{ secrets.ADOBE_BOT_NPM_TOKEN }}
37+
38+
semantic-release:
39+
runs-on: ubuntu-latest
40+
needs: build
41+
if: github.ref == 'refs/heads/main'
42+
steps:
43+
- name: Check out
44+
uses: actions/checkout@v4
45+
with:
46+
persist-credentials: 'false'
47+
48+
- name: Configure Environment
49+
run: echo -e "LOG_LEVEL=info\n" > .env
50+
51+
- name: Setup Node & NPM
52+
uses: ./.github/actions/setup-node-npm
53+
54+
- name: Configure AWS
55+
uses: ./.github/actions/configure-aws
56+
with:
57+
aws_role_to_assume: 'arn:aws:iam::${{secrets.AWS_ACCOUNT_ID_PROD}}:role/spacecat-role-github-actions'
58+
59+
- name: Semantic Release
60+
run: npm run semantic-release
61+
env:
62+
GITHUB_TOKEN: ${{ secrets.ADOBE_BOT_GITHUB_TOKEN }}
63+
NPM_TOKEN: ${{ secrets.ADOBE_BOT_NPM_TOKEN }}
64+
AWS_REGION: us-east-1
65+
AWS_ACCOUNT_ID: ${{secrets.AWS_ACCOUNT_ID_PROD}}
66+
67+
deploy-stage:
68+
runs-on: ubuntu-latest
69+
needs: build
70+
if: github.ref == 'refs/heads/main'
71+
steps:
72+
- name: Check out
73+
uses: actions/checkout@v4
74+
with:
75+
persist-credentials: 'false'
76+
77+
- name: Setup Node & NPM
78+
uses: ./.github/actions/setup-node-npm
79+
80+
- name: Configure AWS for STAGE
81+
uses: ./.github/actions/configure-aws
82+
with:
83+
aws_role_to_assume: 'arn:aws:iam::${{secrets.AWS_ACCOUNT_ID_STAGE}}:role/spacecat-role-github-actions'
84+
85+
- name: Branch Deployment
86+
run: npm run deploy-stage
87+
env:
88+
AWS_REGION: us-east-1
89+
AWS_ACCOUNT_ID: ${{secrets.AWS_ACCOUNT_ID_STAGE}}
90+
91+
92+
branch-deploy:
93+
runs-on: ubuntu-latest
94+
needs: build
95+
if: github.ref != 'refs/heads/main'
96+
steps:
97+
- name: Check out
98+
uses: actions/checkout@v4
99+
with:
100+
persist-credentials: 'false'
101+
102+
- name: Setup Node & NPM
103+
uses: ./.github/actions/setup-node-npm
104+
105+
- name: Configure AWS
106+
uses: ./.github/actions/configure-aws
107+
with:
108+
aws_role_to_assume: 'arn:aws:iam::${{secrets.AWS_ACCOUNT_ID_DEV}}:role/spacecat-role-github-actions'
109+
110+
- name: Branch Deployment
111+
run: npm run deploy-dev
112+
env:
113+
AWS_REGION: us-east-1
114+
AWS_ACCOUNT_ID: ${{secrets.AWS_ACCOUNT_ID_DEV}}
115+
116+
- name: Post-Deployment Integration Test
117+
run: npm run test-postdeploy

0 commit comments

Comments
 (0)