Skip to content

Commit

Permalink
Merge branch 'develop' into enhancement/update-model-20240925
Browse files Browse the repository at this point in the history
  • Loading branch information
estohlmann authored Sep 26, 2024
2 parents f0583bc + 2a9a89d commit 0cdbe1c
Show file tree
Hide file tree
Showing 8 changed files with 70 additions and 17 deletions.
1 change: 1 addition & 0 deletions .github/workflows/code.hotfix.branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ jobs:
DST_TAG=${{ github.event.inputs.dest_tag }}
git checkout -b hotfix/${{ github.event.inputs.dest_tag }}
sed -i -e "s/\"version\": \"${SRC_TAG:1}\"/\"version\": \"${DST_TAG:1}\"/g" package.json
sed -i -e "s/\"version\": \"${SRC_TAG:1}\"/\"version\": \"${DST_TAG:1}\"/g" lib/user-interface/react/package.json
sed -i -e "s/version = \"${SRC_TAG:1}\"/version = \"${DST_TAG:1}\"/g" lisa-sdk/pyproject.toml
sed -i -e "s/${SRC_TAG:1}/${DST_TAG:1}/g" VERSION
git commit -a -m "Updating version for hotfix ${{ github.event.inputs.dest_tag }}"
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/code.release.branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ jobs:
git config --global user.name "github_actions_lisa"
RELEASE_TAG=${{ github.event.inputs.release_tag }}
git checkout -b release/${{ github.event.inputs.release_tag }}
echo "$( jq --arg version ${RELEASE_TAG:1} '.version = $version' lib/user-interface/react/package.json )" > lib/user-interface/react/package.json
echo "$( jq --arg version ${RELEASE_TAG:1} '.version = $version' package.json )" > package.json
sed -E -i -e "s/version = \"[0-9\.].+\"/version = \"${RELEASE_TAG:1}\"/g" lisa-sdk/pyproject.toml
echo ${RELEASE_TAG:1} > VERSION
Expand Down
1 change: 1 addition & 0 deletions lib/user-interface/react/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>AWS LISA Chatbot</title>
<script src="%BASE_URL%env.js"></script>
<script src="%BASE_URL%git-info.js"></script>
</head>
<body style="margin:0px">
<div id="root" class="antialiased"></div>
Expand Down
38 changes: 25 additions & 13 deletions lib/user-interface/react/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions lib/user-interface/react/package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "react",
"name": "lisa-web",
"private": true,
"version": "0.0.0",
"version": "3.0.1",
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"build": "node ./scripts/set-revision-info.mjs && tsc && vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview",
"format": "prettier --ignore-path .gitignore --write \"**/*.+(tsx|js|ts|json)\""
Expand All @@ -19,6 +19,7 @@
"@microsoft/fetch-event-source": "^2.0.1",
"@reduxjs/toolkit": "^1.9.5",
"axios": "^1.7.4",
"git-repo-info": "^2.1.1",
"langchain": "^0.1.12",
"lodash": "^4.17.21",
"luxon": "^3.4.0",
Expand Down
32 changes: 32 additions & 0 deletions lib/user-interface/react/scripts/set-revision-info.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/**
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License").
You may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
import getRepoInfo from 'git-repo-info';
import fs from 'fs';
import packageFile from '../package.json' with { type: 'json' };


const info = getRepoInfo();
console.log('Git Revision Info:');
console.log('Version:', packageFile.version);
console.log('Latest hash:', info.abbreviatedSha);

const revInfo = `window.gitInfo = {
revisionTag: '${packageFile.version}',
gitHash: '${info.abbreviatedSha}',
};
`;

fs.writeFileSync('./public/git-info.js', revInfo);
3 changes: 2 additions & 1 deletion lib/user-interface/react/src/components/Topbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ function Topbar () {
}
},
iconName: 'user-profile',
items: [auth.isAuthenticated ? { id: 'signout', text: 'Sign out' } : { id: 'signin', text: 'Sign in' }],
items: [{id: 'version-info', text: `LISA v${window.gitInfo?.revisionTag}`, disabled: true},
auth.isAuthenticated ? { id: 'signout', text: 'Sign out' } : { id: 'signin', text: 'Sign in' }],
},
{
type: 'button',
Expand Down
4 changes: 4 additions & 0 deletions lib/user-interface/react/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ declare global {
},
];
};
gitInfo?: {
revisionTag?: string;
gitHash?: string;
};
}
}

Expand Down

0 comments on commit 0cdbe1c

Please sign in to comment.