app-tutor-ai-consumer 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.adr-dir +1 -0
- package/.github/CODEOWNERS +1 -0
- package/.github/pull_request_template.md +46 -0
- package/.github/workflows/jira.yaml +13 -0
- package/.github/workflows/merge-checker.yaml +14 -0
- package/.github/workflows/pr-agent.yaml +17 -0
- package/.github/workflows/production.yml +155 -0
- package/.github/workflows/quality.yml +63 -0
- package/.github/workflows/rollback.yml +133 -0
- package/.github/workflows/staging.yml +153 -0
- package/.husky/commit-msg +1 -0
- package/.husky/post-merge +1 -0
- package/.husky/pre-commit +1 -0
- package/.nvmrc +1 -0
- package/.prettierignore +8 -0
- package/.prettierrc +20 -0
- package/.releaserc.json +22 -0
- package/CHANGELOG.md +7 -0
- package/babel.config.js +3 -0
- package/catalog-info.yaml +21 -0
- package/commitlint.config.js +8 -0
- package/config/certs/.keep +0 -0
- package/config/certs/ssl-generate.sh +12 -0
- package/config/rspack/rspack.config.js +176 -0
- package/config/rspack/utils/alias.js +12 -0
- package/config/rspack/utils/devserver.config.js +34 -0
- package/config/rspack/utils/envs.js +39 -0
- package/config/rspack/utils/paths.js +29 -0
- package/config/rspack/utils/plugins.js +41 -0
- package/config/vitest/__mocks__/i18n.tsx +15 -0
- package/config/vitest/index.ts +1 -0
- package/config/vitest/polyfills/global.js +19 -0
- package/config/vitest/setupTests.ts +26 -0
- package/config/vitest/vitest.config.mts +47 -0
- package/docs/README.md +15 -0
- package/docs/architecture/decisions/index.md +0 -0
- package/docs/architecture/decisions/templates/template.md +82 -0
- package/docs/architecture/design/index.md +0 -0
- package/environments/.env.development +42 -0
- package/environments/.env.production +41 -0
- package/environments/.env.staging +40 -0
- package/environments/.env.test +41 -0
- package/eslint.config.mjs +87 -0
- package/mkdocs.yaml +11 -0
- package/package.json +130 -0
- package/postcss.config.js +3 -0
- package/public/favicon.ico +0 -0
- package/public/index.html +18 -0
- package/scripts/generate-icon-types.js +31 -0
- package/src/@types/declarations.d.ts +25 -0
- package/src/@types/env.d.ts +1 -0
- package/src/@types/global.types.ts +64 -0
- package/src/@types/index.d.ts +16 -0
- package/src/config/i18n/constants.ts +9 -0
- package/src/config/i18n/hooks/index.ts +1 -0
- package/src/config/i18n/hooks/use-app-lang/index.ts +1 -0
- package/src/config/i18n/hooks/use-app-lang/use-app-lang.tsx +22 -0
- package/src/config/i18n/index.ts +5 -0
- package/src/config/i18n/init.ts +44 -0
- package/src/config/i18n/types.ts +5 -0
- package/src/config/i18n/utils/get-lang.ts +10 -0
- package/src/config/styles/global.css +171 -0
- package/src/config/styles/index.css +5 -0
- package/src/config/styles/shared-styles.module.css +16 -0
- package/src/config/tests/abstract-mock-generator.ts +9 -0
- package/src/config/tests/customRenderHook.tsx +32 -0
- package/src/config/tests/handlers.ts +7 -0
- package/src/config/tests/index.ts +4 -0
- package/src/config/tests/mockRequest.tsx +36 -0
- package/src/config/tests/types.ts +10 -0
- package/src/config/tests/utils.tsx +38 -0
- package/src/config/tests/worker.ts +5 -0
- package/src/config/tests/wrappers.tsx +50 -0
- package/src/development-bootstrap.tsx +26 -0
- package/src/index.tsx +26 -0
- package/src/lib/components/icons/icon-names.d.ts +2 -0
- package/src/lib/components/icons/icon.tsx +41 -0
- package/src/lib/components/icons/index.ts +1 -0
- package/src/lib/components/icons/send.svg +3 -0
- package/src/lib/components/index.ts +1 -0
- package/src/lib/components/spinner/index.ts +2 -0
- package/src/lib/components/spinner/spinner.tsx +25 -0
- package/src/lib/components/spinner/styles.module.css +31 -0
- package/src/lib/components/spinner/types.ts +1 -0
- package/src/lib/hooks/index.ts +1 -0
- package/src/lib/hooks/use-default-id/index.ts +1 -0
- package/src/lib/hooks/use-default-id/use-default-id.tsx +13 -0
- package/src/lib/utils/constants.ts +2 -0
- package/src/lib/utils/http-codes.ts +13 -0
- package/src/lib/utils/index.ts +3 -0
- package/src/lib/utils/languages.ts +7 -0
- package/src/main/index.ts +1 -0
- package/src/main/main.spec.tsx +15 -0
- package/src/main/main.tsx +27 -0
- package/src/main/styles.module.css +15 -0
- package/src/modules/create-message/components/chat-input/chat-input.tsx +29 -0
- package/src/modules/create-message/components/chat-input/index.ts +2 -0
- package/src/modules/create-message/components/chat-input/types.ts +3 -0
- package/src/modules/create-message/components/index.ts +1 -0
- package/src/modules/widget/components/ai-avatar/ai-avatar.tsx +59 -0
- package/src/modules/widget/components/ai-avatar/index.ts +1 -0
- package/src/modules/widget/components/greetings-card/greetings-card.tsx +40 -0
- package/src/modules/widget/components/greetings-card/index.ts +1 -0
- package/src/modules/widget/components/greetings-card/styles.module.css +9 -0
- package/src/modules/widget/components/index.ts +1 -0
- package/src/modules/widget/events.ts +21 -0
- package/src/modules/widget/index.ts +2 -0
- package/src/modules/widget/types.ts +7 -0
- package/src/types.ts +23 -0
- package/tailwind.config.js +8 -0
- package/tsconfig.json +128 -0
package/.adr-dir
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
docs/architecture/decisions
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
* @Hotmart-Org/learning-experience @gabrielsouza-hotmart @gustavolima-hotmart @luaschwertner-hotmart @tarsysfonseca-hotmart
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
## Proposed changes
|
|
2
|
+
|
|
3
|
+
_Describe here what your proposed changes brings to this project. Don't forget the task code right below_
|
|
4
|
+
|
|
5
|
+
Jira: [LEX-XXXX](https://hotmart.atlassian.net/browse/LEX-XXXX)
|
|
6
|
+
|
|
7
|
+
## Type of changes
|
|
8
|
+
|
|
9
|
+
What types of changes does your code apply on this repo?
|
|
10
|
+
_Put an `x` in the boxes that apply_
|
|
11
|
+
|
|
12
|
+
- [ ] Bugfix (non-breaking change which fixes an issue)
|
|
13
|
+
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
|
|
14
|
+
- [ ] New feature (non-breaking change which adds functionality)
|
|
15
|
+
- [ ] Refactor
|
|
16
|
+
- [ ] Documentation
|
|
17
|
+
- [ ] Dependencies
|
|
18
|
+
- [ ] Architecture
|
|
19
|
+
- [ ] Infra
|
|
20
|
+
- [ ] Events (Datahub/Google Analytics etc..)
|
|
21
|
+
- [ ] Merge
|
|
22
|
+
- [ ] Tests
|
|
23
|
+
- [ ] Versioning
|
|
24
|
+
- [ ] Other (please, specify)
|
|
25
|
+
|
|
26
|
+
## Quality
|
|
27
|
+
|
|
28
|
+
_Put an `x` in the boxes that apply._
|
|
29
|
+
|
|
30
|
+
- [ ] I have added tests that prove my fix is effective or that my feature works
|
|
31
|
+
- [ ] Best accessibility practices were used
|
|
32
|
+
- [ ] The stylization was designed considering responsiveness and mobile-first design
|
|
33
|
+
- [ ] I used i18n on all the labels that needed
|
|
34
|
+
- [ ] Not applicable
|
|
35
|
+
|
|
36
|
+
## If somethings goes wrong with these changes, we must
|
|
37
|
+
|
|
38
|
+
_Put an `x` in the boxes that apply._
|
|
39
|
+
|
|
40
|
+
- [ ] Revert this PR
|
|
41
|
+
- [ ] Disable the feature toggle
|
|
42
|
+
- [ ] Other (please, specify)
|
|
43
|
+
|
|
44
|
+
## Further comments
|
|
45
|
+
|
|
46
|
+
If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
name: PR Agent
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
types: [opened, reopened, ready_for_review]
|
|
6
|
+
issue_comment:
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
pr-agent:
|
|
10
|
+
permissions:
|
|
11
|
+
issues: write
|
|
12
|
+
pull-requests: write
|
|
13
|
+
contents: write
|
|
14
|
+
uses: Hotmart-Org/actions/.github/workflows/pr-agent.yaml@master
|
|
15
|
+
secrets: inherit
|
|
16
|
+
with:
|
|
17
|
+
runs-on: "club-iac"
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
name: Production Deployment
|
|
2
|
+
run-name: 'Production deployment: ${{ github.ref_type }} ${{ github.ref_name }} by @${{ github.actor }}'
|
|
3
|
+
|
|
4
|
+
on:
|
|
5
|
+
push:
|
|
6
|
+
tags:
|
|
7
|
+
- 'release/v*'
|
|
8
|
+
release:
|
|
9
|
+
types: [published]
|
|
10
|
+
|
|
11
|
+
concurrency: production
|
|
12
|
+
|
|
13
|
+
env:
|
|
14
|
+
APP_NAME: app-tutor-ai-consumer
|
|
15
|
+
BUCKET_NAME: app-club-microfrontends-prod
|
|
16
|
+
AWS_DEFAULT_REGION: us-east-1
|
|
17
|
+
CLOUDFRONT_ACCOUNT_ID: '357420915163'
|
|
18
|
+
CLOUDFRONT_DISTRIBUTION: 'E1978HYPIC2KA1'
|
|
19
|
+
CLOUDFRONT_URL: https://app-club-microfrontends-prod.cp.hotmart.com
|
|
20
|
+
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
|
|
21
|
+
BRANCH_REF: main
|
|
22
|
+
|
|
23
|
+
jobs:
|
|
24
|
+
deploy-production:
|
|
25
|
+
if: startsWith(github.ref, 'refs/tags/release/v')
|
|
26
|
+
name: Prod Deployment
|
|
27
|
+
runs-on: [content-high-iac]
|
|
28
|
+
steps:
|
|
29
|
+
- name: Checkout
|
|
30
|
+
uses: actions/checkout@v4
|
|
31
|
+
with:
|
|
32
|
+
token: ${{ secrets.CI_GH_TOKEN }}
|
|
33
|
+
fetch-depth: 0
|
|
34
|
+
ref: ${{ env.BRANCH_REF }}
|
|
35
|
+
fetch-tags: true
|
|
36
|
+
|
|
37
|
+
- name: Restore Cache
|
|
38
|
+
uses: Hotmart-Org/actions/cache@master
|
|
39
|
+
with:
|
|
40
|
+
bucket: club-pipeline-cache
|
|
41
|
+
cache-key: "${{ hashFiles('package.json') }}"
|
|
42
|
+
restore: true
|
|
43
|
+
mount: 'node_modules/'
|
|
44
|
+
|
|
45
|
+
- name: Setup Node.js
|
|
46
|
+
uses: actions/setup-node@v4
|
|
47
|
+
with:
|
|
48
|
+
node-version-file: '.nvmrc'
|
|
49
|
+
|
|
50
|
+
- name: Retrieve .npmrc
|
|
51
|
+
uses: Hotmart-Org/actions/codeartifact@master
|
|
52
|
+
with:
|
|
53
|
+
npmrc: '${{ secrets.NPM_RC }}'
|
|
54
|
+
fontawesome-registry-token: ${{ secrets.FONTAWESOME_REGISTRY_TOKEN }}
|
|
55
|
+
|
|
56
|
+
- name: Install Dependencies
|
|
57
|
+
run: npm ci --include=optional
|
|
58
|
+
|
|
59
|
+
- name: Build Prod
|
|
60
|
+
run: npm run build && ls -la ./dist
|
|
61
|
+
|
|
62
|
+
- name: Deploy Microfrontend s3 - ${{ env.APP_NAME }}
|
|
63
|
+
uses: Hotmart-Org/actions/s3/microfrontend/deploy@master
|
|
64
|
+
with:
|
|
65
|
+
bucket-name: ${{ env.BUCKET_NAME }}
|
|
66
|
+
app-name: ${{ env.APP_NAME }}
|
|
67
|
+
package-json-path: ./package.json
|
|
68
|
+
bundle-source: ./dist
|
|
69
|
+
account-id: ${{ env.CLOUDFRONT_ACCOUNT_ID }}
|
|
70
|
+
cdn-distribution: ${{ env.CLOUDFRONT_DISTRIBUTION }}
|
|
71
|
+
cdn-url: ${{ env.CLOUDFRONT_URL }}
|
|
72
|
+
|
|
73
|
+
- name: Rebuild Cache
|
|
74
|
+
uses: Hotmart-Org/actions/cache@master
|
|
75
|
+
with:
|
|
76
|
+
bucket: club-pipeline-cache
|
|
77
|
+
cache-key: "${{ hashFiles('package.json') }}"
|
|
78
|
+
rebuild: true
|
|
79
|
+
mount: 'node_modules/'
|
|
80
|
+
|
|
81
|
+
production-release-notification:
|
|
82
|
+
name: 'Production Release Notification'
|
|
83
|
+
runs-on: [content-iac]
|
|
84
|
+
needs: ['deploy-production']
|
|
85
|
+
steps:
|
|
86
|
+
- name: Checkout
|
|
87
|
+
uses: actions/checkout@v4
|
|
88
|
+
|
|
89
|
+
- name: Extract version from package.json
|
|
90
|
+
run: |
|
|
91
|
+
VERSION=$(cat package.json | jq -r .version)
|
|
92
|
+
echo "Extracted version: $VERSION"
|
|
93
|
+
echo "VERSION=$VERSION" >> $GITHUB_ENV
|
|
94
|
+
- name: New Relic Application Deployment Notification
|
|
95
|
+
uses: newrelic/deployment-marker-action@v2.5.1
|
|
96
|
+
env:
|
|
97
|
+
VERSION: ${{ env.VERSION }}
|
|
98
|
+
NEW_RELIC_API_KEY: NRAK-NX0XDEQLIGCEWTLWS6EQ17B4VY1
|
|
99
|
+
NEW_RELIC_DEPLOYMENT_ENTITY_GUID: Mjc1MDN8QVBNfEFQUExJQ0FUSU9OfDEwOTUyNjI4MTc
|
|
100
|
+
with:
|
|
101
|
+
apiKey: ${{ env.NEW_RELIC_API_KEY }}
|
|
102
|
+
guid: ${{ env.NEW_RELIC_DEPLOYMENT_ENTITY_GUID }}
|
|
103
|
+
version: ${{ env.VERSION }}
|
|
104
|
+
user: ${{ github.actor }}
|
|
105
|
+
changelog: 'https://github.com/${{ github.repository }}/blob/main/CHANGELOG.md'
|
|
106
|
+
commit: '${{ github.sha }}'
|
|
107
|
+
description: 'Deploy: ${{env.APP_NAME}} v${{env.VERSION}} - ${{ github.ref_name }}'
|
|
108
|
+
|
|
109
|
+
- name: Sends chat notification
|
|
110
|
+
uses: Hotmart-Org/actions/notification@master
|
|
111
|
+
with:
|
|
112
|
+
type: 'Original'
|
|
113
|
+
author: true
|
|
114
|
+
webhook-chat: 'https://chat.googleapis.com/v1/spaces/AAAA1nvOyjo/messages?key=AIzaSyDdI0hCZtE6vySjMm-WEfRq3CPzqKqqsHI&token=uuL7DA8zTxUkJjQa39HIM0TYVZV0DvneZ0mklNhEr5M'
|
|
115
|
+
body: |
|
|
116
|
+
{
|
|
117
|
+
"text": "🚀 *[PRODUCTION] app-club-consumer v${{ env.VERSION }}*: production deploy: ${{ github.ref_name }}",
|
|
118
|
+
"cards": [
|
|
119
|
+
{
|
|
120
|
+
"header": {
|
|
121
|
+
"title": "Started by ${{ github.actor }}"
|
|
122
|
+
},
|
|
123
|
+
"sections": [
|
|
124
|
+
{
|
|
125
|
+
"widgets": [
|
|
126
|
+
{
|
|
127
|
+
"buttons": [
|
|
128
|
+
{
|
|
129
|
+
"textButton": {
|
|
130
|
+
"onClick": {
|
|
131
|
+
"openLink": {
|
|
132
|
+
"url": "${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }}"
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
"text": "View commit"
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
"textButton": {
|
|
140
|
+
"onClick": {
|
|
141
|
+
"openLink": {
|
|
142
|
+
"url": "https://github.com/Hotmart-Org/app-club-consumer/actions/runs/${{ github.run_id }}"
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
"text": "Follow this deploy"
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
]
|
|
149
|
+
}
|
|
150
|
+
]
|
|
151
|
+
}
|
|
152
|
+
]
|
|
153
|
+
}
|
|
154
|
+
]
|
|
155
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
name: Quality Checks
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
branches:
|
|
6
|
+
- '*'
|
|
7
|
+
|
|
8
|
+
env:
|
|
9
|
+
LANG_ENV: staging
|
|
10
|
+
GH_TOKEN: ${{ secrets.CI_GH_TOKEN }}
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
quality-checks:
|
|
14
|
+
runs-on: [buildstaging-high-iac]
|
|
15
|
+
steps:
|
|
16
|
+
- name: Checkout Repository
|
|
17
|
+
uses: actions/checkout@v4
|
|
18
|
+
|
|
19
|
+
- name: Setup Node
|
|
20
|
+
uses: actions/setup-node@v4
|
|
21
|
+
with:
|
|
22
|
+
node-version-file: '.nvmrc'
|
|
23
|
+
|
|
24
|
+
- name: Retrieve .npmrc
|
|
25
|
+
uses: Hotmart-Org/actions/codeartifact@master
|
|
26
|
+
with:
|
|
27
|
+
npmrc: ${{ secrets.NPM_RC }}
|
|
28
|
+
fontawesome-registry-token: ${{ secrets.FONTAWESOME_REGISTRY_TOKEN }}
|
|
29
|
+
|
|
30
|
+
- name: Restore Cache
|
|
31
|
+
uses: Hotmart-Org/actions/cache@master
|
|
32
|
+
with:
|
|
33
|
+
bucket: buildstaging-pipeline-cache
|
|
34
|
+
cache-key: "${{ hashFiles('package.json') }}"
|
|
35
|
+
restore: true
|
|
36
|
+
mount: 'node_modules/'
|
|
37
|
+
|
|
38
|
+
- name: install-dependencies
|
|
39
|
+
run: npm ci --include=optional
|
|
40
|
+
|
|
41
|
+
- name: run-lint
|
|
42
|
+
run: npm run lint:fix
|
|
43
|
+
|
|
44
|
+
- name: pre-build-staging
|
|
45
|
+
run: |
|
|
46
|
+
echo "${{ env.LANG_ENV }}"
|
|
47
|
+
rm -rf public/locales
|
|
48
|
+
mkdir public/locales
|
|
49
|
+
npm run fetch-langs
|
|
50
|
+
|
|
51
|
+
- name: quality
|
|
52
|
+
run: npm run test:ci -- --mode test
|
|
53
|
+
|
|
54
|
+
- name: build-staging
|
|
55
|
+
run: npm run build:staging
|
|
56
|
+
|
|
57
|
+
- name: Rebuild Cache
|
|
58
|
+
uses: Hotmart-Org/actions/cache@master
|
|
59
|
+
with:
|
|
60
|
+
bucket: buildstaging-pipeline-cache
|
|
61
|
+
cache-key: "${{ hashFiles('package.json') }}"
|
|
62
|
+
rebuild: true
|
|
63
|
+
mount: 'node_modules/'
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
name: Rollback Workflow 🔄
|
|
2
|
+
run-name: 'Rollback deployment: ${{ github.event.inputs.rollbackEnv }} to version: ${{ github.event.inputs.rollbackVersion }} by @${{ github.actor }}'
|
|
3
|
+
|
|
4
|
+
on:
|
|
5
|
+
workflow_dispatch:
|
|
6
|
+
inputs:
|
|
7
|
+
rollbackEnv:
|
|
8
|
+
description: 'Choose the environment for rollback ["staging" or "production"]'
|
|
9
|
+
type: choice
|
|
10
|
+
options:
|
|
11
|
+
- staging
|
|
12
|
+
- production
|
|
13
|
+
rollbackVersion:
|
|
14
|
+
description: '⚠️ Enter the rollback version - only numbers Ex: [1.62.3] | For staging check available tags / For production check available releases'
|
|
15
|
+
required: true
|
|
16
|
+
default: ''
|
|
17
|
+
|
|
18
|
+
# global environments
|
|
19
|
+
env:
|
|
20
|
+
APP_NAME: app-tutor-ai-consumer
|
|
21
|
+
GH_TOKEN: ${{ secrets.CI_GH_TOKEN }}
|
|
22
|
+
|
|
23
|
+
jobs:
|
|
24
|
+
staging-rollback:
|
|
25
|
+
if: ${{ github.event.inputs.rollbackEnv == 'staging' }}
|
|
26
|
+
name: Staging Rollback
|
|
27
|
+
runs-on: [buildstaging-iac]
|
|
28
|
+
env:
|
|
29
|
+
BUCKET_NAME: app-club-microfrontends
|
|
30
|
+
CLOUDFRONT_ACCOUNT_ID: '449466460580'
|
|
31
|
+
CLOUDFRONT_DISTRIBUTION: 'E19SXB8YMSF4QX'
|
|
32
|
+
CLOUDFRONT_URL: https://app-club-microfrontends.buildstaging.com
|
|
33
|
+
ENVIRONMENT: ${{ github.event.inputs.rollbackEnv }}
|
|
34
|
+
ROLLBACK_VERSION: ${{ github.event.inputs.rollbackVersion }}
|
|
35
|
+
steps:
|
|
36
|
+
- name: Staging Rollback Microfrontend s3 - ${{ env.APP_NAME }} ${{ github.event.inputs.rollbackVersion }} ${{ github.event.inputs.rollbackEnv }}
|
|
37
|
+
uses: Hotmart-Org/actions/s3/microfrontend/rollback@master
|
|
38
|
+
with:
|
|
39
|
+
bucket-name: ${{ env.BUCKET_NAME }}
|
|
40
|
+
app-name: ${{ env.APP_NAME }}
|
|
41
|
+
account-id: ${{ env.CLOUDFRONT_ACCOUNT_ID }}
|
|
42
|
+
cdn-distribution: ${{ env.CLOUDFRONT_DISTRIBUTION }}
|
|
43
|
+
cdn-url: ${{ env.CLOUDFRONT_URL }}
|
|
44
|
+
environment: ${{ env.ENVIRONMENT }}
|
|
45
|
+
rollback-version: ${{ env.ROLLBACK_VERSION }}
|
|
46
|
+
|
|
47
|
+
new-relic-notification-staging:
|
|
48
|
+
name: New Relic Application Deployment Notification
|
|
49
|
+
runs-on: [buildstaging-iac]
|
|
50
|
+
needs: ['staging-rollback']
|
|
51
|
+
steps:
|
|
52
|
+
- name: Display rollback tag version
|
|
53
|
+
run: |
|
|
54
|
+
echo "🔄 Rolling back to version: ${{ github.event.inputs.rollbackVersion }} / ${{ github.event.inputs.rollbackEnv }}"
|
|
55
|
+
|
|
56
|
+
- name: New Relic Application Deployment Notification
|
|
57
|
+
uses: newrelic/deployment-marker-action@v2.5.1
|
|
58
|
+
env:
|
|
59
|
+
ROLLBACK_VERSION: ${{ github.event.inputs.rollbackVersion }}
|
|
60
|
+
NEW_RELIC_API_KEY: NRAK-14TLYFWRA5RCKUGK4A3TJSAPU78
|
|
61
|
+
NEW_RELIC_DEPLOYMENT_ENTITY_GUID: Mjc1MDN8QVBNfEFQUExJQ0FUSU9OfDEwOTE1MDMzMTE
|
|
62
|
+
with:
|
|
63
|
+
apiKey: ${{ env.NEW_RELIC_API_KEY }}
|
|
64
|
+
guid: ${{ env.NEW_RELIC_DEPLOYMENT_ENTITY_GUID }}
|
|
65
|
+
version: ${{ env.ROLLBACK_VERSION }}
|
|
66
|
+
user: '${{ github.actor }}'
|
|
67
|
+
changelog: 'https://github.com/${{ github.repository }}/blob/main/CHANGELOG.md'
|
|
68
|
+
commit: '${{ github.sha }}'
|
|
69
|
+
description: 'Rollback: ${{env.APP_NAME}} v${{env.ROLLBACK_VERSION}} - ${{ github.ref_name }}'
|
|
70
|
+
|
|
71
|
+
production-rollback:
|
|
72
|
+
if: ${{ github.event.inputs.rollbackEnv == 'production' }}
|
|
73
|
+
name: Production Rollback
|
|
74
|
+
runs-on: [content-iac]
|
|
75
|
+
env:
|
|
76
|
+
BUCKET_NAME: app-club-microfrontends-prod
|
|
77
|
+
CLOUDFRONT_ACCOUNT_ID: '357420915163'
|
|
78
|
+
CLOUDFRONT_DISTRIBUTION: 'E1978HYPIC2KA1'
|
|
79
|
+
CLOUDFRONT_URL: https://app-club-microfrontends-prod.cp.hotmart.com
|
|
80
|
+
ENVIRONMENT: ${{ github.event.inputs.rollbackEnv }}
|
|
81
|
+
ROLLBACK_VERSION: ${{ github.event.inputs.rollbackVersion }}
|
|
82
|
+
steps:
|
|
83
|
+
- name: Production Rollback Microfrontend s3 - ${{ env.APP_NAME }} ${{ github.event.inputs.rollbackVersion }} ${{ github.event.inputs.rollbackEnv }}
|
|
84
|
+
uses: Hotmart-Org/actions/s3/microfrontend/rollback@master
|
|
85
|
+
with:
|
|
86
|
+
bucket-name: ${{ env.BUCKET_NAME }}
|
|
87
|
+
app-name: ${{ env.APP_NAME }}
|
|
88
|
+
account-id: ${{ env.CLOUDFRONT_ACCOUNT_ID }}
|
|
89
|
+
cdn-distribution: ${{ env.CLOUDFRONT_DISTRIBUTION }}
|
|
90
|
+
cdn-url: ${{ env.CLOUDFRONT_URL }}
|
|
91
|
+
environment: ${{ env.ENVIRONMENT }}
|
|
92
|
+
rollback-version: ${{ env.ROLLBACK_VERSION }}
|
|
93
|
+
|
|
94
|
+
new-relic-notification-production:
|
|
95
|
+
name: New Relic Application Deployment Notification
|
|
96
|
+
runs-on: [content-iac]
|
|
97
|
+
needs: ['production-rollback']
|
|
98
|
+
steps:
|
|
99
|
+
- name: Display rollback tag version
|
|
100
|
+
run: |
|
|
101
|
+
echo "🔄 Rolling back to version: ${{ github.event.inputs.rollbackVersion }} / ${{ github.event.inputs.rollbackEnv }}"
|
|
102
|
+
|
|
103
|
+
- name: New Relic Application Deployment Notification
|
|
104
|
+
uses: newrelic/deployment-marker-action@v2.5.1
|
|
105
|
+
env:
|
|
106
|
+
ROLLBACK_VERSION: ${{ github.event.inputs.rollbackVersion }}
|
|
107
|
+
NEW_RELIC_API_KEY: NRAK-NX0XDEQLIGCEWTLWS6EQ17B4VY1
|
|
108
|
+
NEW_RELIC_DEPLOYMENT_ENTITY_GUID: Mjc1MDN8QVBNfEFQUExJQ0FUSU9OfDEwOTUyNjI4MTc
|
|
109
|
+
with:
|
|
110
|
+
apiKey: ${{ env.NEW_RELIC_API_KEY }}
|
|
111
|
+
guid: ${{ env.NEW_RELIC_DEPLOYMENT_ENTITY_GUID }}
|
|
112
|
+
version: ${{ env.ROLLBACK_VERSION }}
|
|
113
|
+
user: '${{ github.actor }}'
|
|
114
|
+
changelog: 'https://github.com/${{ github.repository }}/blob/main/CHANGELOG.md'
|
|
115
|
+
commit: '${{ github.sha }}'
|
|
116
|
+
description: 'Rollback: ${{env.APP_NAME}} v${{env.ROLLBACK_VERSION}} - ${{ github.ref_name }}'
|
|
117
|
+
|
|
118
|
+
- name: Sends Chat Notification
|
|
119
|
+
uses: Hotmart-Org/actions/notification@master
|
|
120
|
+
env:
|
|
121
|
+
ROLLBACK_VERSION: ${{ github.event.inputs.rollbackVersion }}
|
|
122
|
+
ROLLBACK_ENV: ${{ github.event.inputs.rollbackEnv }}
|
|
123
|
+
with:
|
|
124
|
+
webhook-chat: >-
|
|
125
|
+
https://chat.googleapis.com/v1/spaces/AAAA1sn1iiE/messages?key=AIzaSyDdI0hCZtE6vySjMm-WEfRq3CPzqKqqsHI&token=JVaCKxIPX2oHcZi_KJoCgwFpGg54FxVUNDaB8ll3AQ4
|
|
126
|
+
author: false
|
|
127
|
+
type: Original
|
|
128
|
+
title: Rollback *@hotmart/${{env.APP_NAME}}*
|
|
129
|
+
from: |-
|
|
130
|
+
\nAuthor: *${{ github.actor }}*
|
|
131
|
+
Version: *${{ env.ROLLBACK_VERSION }}*
|
|
132
|
+
Environment: *${{ env.ROLLBACK_ENV }}*
|
|
133
|
+
content: "Message *@hotmart/${{env.APP_NAME}}* was deployed successfully 🚀 \\n\\n *Sentry Dashboard:* https://hotmart.sentry.io/dashboard/77607/?project=4507153105747968&statsPeriod=24h \\n *Sentry Releases* https://hotmart.sentry.io/releases/?environment=production&project=4507153105747968&statsPeriod=24h \\n *Repository Release:* https://github.com/Hotmart-Org/${{ env.APP_NAME }}/releases \\n *Projects Map:* https://hotmart.atlassian.net/wiki/spaces/Consumer/pages/423133274/Monitoramento+Club \\n *New Relic Dashboard:* https://one.newrelic.com/dashboards/detail/Mjc1MDN8VklafERBU0hCT0FSRHxkYTo2MTIyNTA5"
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
name: Tag & Deploy Staging
|
|
2
|
+
run-name: 'Tag & Staging deployment: ${{ github.ref_type }} ${{ github.ref_name }} by @${{ github.actor }}'
|
|
3
|
+
|
|
4
|
+
on:
|
|
5
|
+
push:
|
|
6
|
+
branches:
|
|
7
|
+
- main
|
|
8
|
+
- staging/*
|
|
9
|
+
|
|
10
|
+
concurrency: staging
|
|
11
|
+
|
|
12
|
+
env:
|
|
13
|
+
APP_NAME: app-tutor-ai-consumer
|
|
14
|
+
BUCKET_NAME: app-club-microfrontends
|
|
15
|
+
AWS_DEFAULT_REGION: us-east-1
|
|
16
|
+
CLOUDFRONT_ACCOUNT_ID: '449466460580'
|
|
17
|
+
CLOUDFRONT_DISTRIBUTION: 'E19SXB8YMSF4QX'
|
|
18
|
+
CLOUDFRONT_URL: https://app-club-microfrontends.buildstaging.com
|
|
19
|
+
GH_TOKEN: ${{ secrets.CI_GH_TOKEN }}
|
|
20
|
+
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
|
|
21
|
+
BRANCH_REF: main
|
|
22
|
+
LANG_ENV: staging
|
|
23
|
+
|
|
24
|
+
jobs:
|
|
25
|
+
create-tag:
|
|
26
|
+
name: Create Tag
|
|
27
|
+
runs-on: [buildstaging-high-iac]
|
|
28
|
+
permissions:
|
|
29
|
+
contents: write
|
|
30
|
+
issues: write
|
|
31
|
+
pull-requests: write
|
|
32
|
+
id-token: write
|
|
33
|
+
steps:
|
|
34
|
+
- name: Checkout
|
|
35
|
+
uses: actions/checkout@v4
|
|
36
|
+
with:
|
|
37
|
+
token: ${{ secrets.CI_GH_TOKEN }}
|
|
38
|
+
fetch-depth: 0
|
|
39
|
+
ref: ${{ env.BRANCH_REF }}
|
|
40
|
+
fetch-tags: true
|
|
41
|
+
|
|
42
|
+
- name: Setup Node.js
|
|
43
|
+
uses: actions/setup-node@v4
|
|
44
|
+
with:
|
|
45
|
+
node-version-file: '.nvmrc'
|
|
46
|
+
|
|
47
|
+
- name: Retrieve .npmrc
|
|
48
|
+
uses: Hotmart-Org/actions/codeartifact@master
|
|
49
|
+
with:
|
|
50
|
+
npmrc: '${{ secrets.NPM_RC }}'
|
|
51
|
+
fontawesome-registry-token: ${{ secrets.FONTAWESOME_REGISTRY_TOKEN }}
|
|
52
|
+
|
|
53
|
+
- name: install-dependencies
|
|
54
|
+
run: npm ci --include=optional
|
|
55
|
+
|
|
56
|
+
- name: Release
|
|
57
|
+
env:
|
|
58
|
+
GITHUB_TOKEN: ${{ secrets.CI_GH_TOKEN }}
|
|
59
|
+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
60
|
+
run: npm run semantic-release
|
|
61
|
+
|
|
62
|
+
deploy-staging:
|
|
63
|
+
name: Deploy Staging
|
|
64
|
+
needs: [create-tag]
|
|
65
|
+
runs-on: [buildstaging-high-iac]
|
|
66
|
+
steps:
|
|
67
|
+
- name: Checkout
|
|
68
|
+
uses: actions/checkout@v4
|
|
69
|
+
with:
|
|
70
|
+
token: ${{ secrets.CI_GH_TOKEN }}
|
|
71
|
+
fetch-depth: 0
|
|
72
|
+
ref: ${{ env.BRANCH_REF }}
|
|
73
|
+
fetch-tags: true
|
|
74
|
+
|
|
75
|
+
- name: Restore Cache
|
|
76
|
+
uses: Hotmart-Org/actions/cache@master
|
|
77
|
+
with:
|
|
78
|
+
bucket: buildstaging-pipeline-cache
|
|
79
|
+
cache-key: "${{ hashFiles('package.json') }}"
|
|
80
|
+
restore: true
|
|
81
|
+
mount: 'node_modules/'
|
|
82
|
+
|
|
83
|
+
- name: Setup Node.js
|
|
84
|
+
uses: actions/setup-node@v4
|
|
85
|
+
with:
|
|
86
|
+
node-version-file: '.nvmrc'
|
|
87
|
+
|
|
88
|
+
- name: Retrieve .npmrc
|
|
89
|
+
uses: Hotmart-Org/actions/codeartifact@master
|
|
90
|
+
with:
|
|
91
|
+
npmrc: ${{ secrets.NPM_RC }}
|
|
92
|
+
fontawesome-registry-token: ${{ secrets.FONTAWESOME_REGISTRY_TOKEN }}
|
|
93
|
+
|
|
94
|
+
- name: install-dependencies
|
|
95
|
+
run: npm ci --include=optional
|
|
96
|
+
|
|
97
|
+
- name: Rebuild Cache
|
|
98
|
+
uses: Hotmart-Org/actions/cache@master
|
|
99
|
+
with:
|
|
100
|
+
bucket: buildstaging-pipeline-cache
|
|
101
|
+
cache-key: "${{ hashFiles('package.json') }}"
|
|
102
|
+
rebuild: true
|
|
103
|
+
mount: 'node_modules/'
|
|
104
|
+
|
|
105
|
+
- name: pre-build-staging
|
|
106
|
+
run: |
|
|
107
|
+
echo "${{ env.LANG_ENV }}"
|
|
108
|
+
rm -rf public/locales
|
|
109
|
+
mkdir public/locales
|
|
110
|
+
npm run fetch-langs
|
|
111
|
+
|
|
112
|
+
- name: build-staging
|
|
113
|
+
run: npm run build:staging
|
|
114
|
+
|
|
115
|
+
- name: Deploy Microfrontend s3 - ${{ env.APP_NAME }}
|
|
116
|
+
uses: Hotmart-Org/actions/s3/microfrontend/deploy@master
|
|
117
|
+
with:
|
|
118
|
+
bucket-name: ${{ env.BUCKET_NAME }}
|
|
119
|
+
app-name: ${{ env.APP_NAME }}
|
|
120
|
+
package-json-path: ./package.json
|
|
121
|
+
bundle-source: ./dist
|
|
122
|
+
account-id: ${{ env.CLOUDFRONT_ACCOUNT_ID }}
|
|
123
|
+
cdn-distribution: ${{ env.CLOUDFRONT_DISTRIBUTION }}
|
|
124
|
+
cdn-url: ${{ env.CLOUDFRONT_URL }}
|
|
125
|
+
|
|
126
|
+
staging-notification:
|
|
127
|
+
name: 'Staging Notification'
|
|
128
|
+
runs-on: [buildstaging-iac]
|
|
129
|
+
needs: ['deploy-staging']
|
|
130
|
+
steps:
|
|
131
|
+
- name: Checkout
|
|
132
|
+
uses: actions/checkout@v4
|
|
133
|
+
|
|
134
|
+
- name: Extract version from package.json
|
|
135
|
+
run: |
|
|
136
|
+
VERSION=$(cat package.json | jq -r .version)
|
|
137
|
+
echo "Extracted version: $VERSION"
|
|
138
|
+
echo "VERSION=$VERSION" >> $GITHUB_ENV
|
|
139
|
+
|
|
140
|
+
- name: New Relic Application Deployment Notification
|
|
141
|
+
uses: newrelic/deployment-marker-action@v2.5.1
|
|
142
|
+
env:
|
|
143
|
+
VERSION: ${{ env.VERSION }}
|
|
144
|
+
NEW_RELIC_API_KEY: NRAK-14TLYFWRA5RCKUGK4A3TJSAPU78
|
|
145
|
+
NEW_RELIC_DEPLOYMENT_ENTITY_GUID: Mjc1MDN8QVBNfEFQUExJQ0FUSU9OfDEwOTE1MDMzMTE
|
|
146
|
+
with:
|
|
147
|
+
apiKey: ${{ env.NEW_RELIC_API_KEY }}
|
|
148
|
+
guid: ${{ env.NEW_RELIC_DEPLOYMENT_ENTITY_GUID }}
|
|
149
|
+
version: ${{ env.VERSION }}
|
|
150
|
+
user: '${{ github.actor }}'
|
|
151
|
+
changelog: 'https://github.com/${{ github.repository }}/blob/main/CHANGELOG.md'
|
|
152
|
+
commit: '${{ github.sha }}'
|
|
153
|
+
description: 'Deploy: ${{env.APP_NAME}} v${{env.VERSION}} - ${{ github.ref_name }}'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
npx --no-install commitlint --edit "$1"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
npm ci
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
npx --no-install lint-staged
|
package/.nvmrc
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
lts/jod
|
package/.prettierignore
ADDED
package/.prettierrc
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"singleQuote": true,
|
|
3
|
+
"semi": false,
|
|
4
|
+
"plugins": ["prettier-plugin-tailwindcss"],
|
|
5
|
+
"arrowParens": "always",
|
|
6
|
+
"bracketSpacing": true,
|
|
7
|
+
"embeddedLanguageFormatting": "auto",
|
|
8
|
+
"htmlWhitespaceSensitivity": "css",
|
|
9
|
+
"insertPragma": false,
|
|
10
|
+
"bracketSameLine": true,
|
|
11
|
+
"jsxSingleQuote": true,
|
|
12
|
+
"printWidth": 100,
|
|
13
|
+
"proseWrap": "preserve",
|
|
14
|
+
"quoteProps": "as-needed",
|
|
15
|
+
"requirePragma": false,
|
|
16
|
+
"tabWidth": 2,
|
|
17
|
+
"useTabs": false,
|
|
18
|
+
"trailingComma": "none",
|
|
19
|
+
"vueIndentScriptAndStyle": true
|
|
20
|
+
}
|
package/.releaserc.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"branches": ["main"],
|
|
3
|
+
"plugins": [
|
|
4
|
+
[
|
|
5
|
+
"@semantic-release/commit-analyzer",
|
|
6
|
+
{
|
|
7
|
+
"releaseRules": [
|
|
8
|
+
{ "type": "chore", "release": "patch" },
|
|
9
|
+
{ "type": "style", "release": "patch" },
|
|
10
|
+
{ "type": "refactor", "release": "patch" }
|
|
11
|
+
],
|
|
12
|
+
"parserOpts": {
|
|
13
|
+
"noteKeywords": ["BREAKING CHANGE", "BREAKING CHANGES"]
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
],
|
|
17
|
+
"@semantic-release/release-notes-generator",
|
|
18
|
+
"@semantic-release/changelog",
|
|
19
|
+
"@semantic-release/npm",
|
|
20
|
+
"@semantic-release/git"
|
|
21
|
+
]
|
|
22
|
+
}
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
## [1.0.1](https://github.com/Hotmart-Org/app-tutor-ai-consumer/compare/v1.0.0...v1.0.1) (2025-06-18)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
- failing optional deps in pipe ([968d541](https://github.com/Hotmart-Org/app-tutor-ai-consumer/commit/968d541b41ab007c5c28c40889cfb48e8c9ba948))
|
|
6
|
+
- prettier trailing comma ([78260e7](https://github.com/Hotmart-Org/app-tutor-ai-consumer/commit/78260e7bd15f95b90e7562ae52e2065a51a72886))
|
|
7
|
+
- vitest config on lint-staged ([5e35f7d](https://github.com/Hotmart-Org/app-tutor-ai-consumer/commit/5e35f7d19872a9159142ff9e20df479231570255))
|