Skip to content

Commit

Permalink
add version string
Browse files Browse the repository at this point in the history
  • Loading branch information
hlorenzi committed Feb 3, 2021
1 parent 2c5ef12 commit 8565e22
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/build_ghpages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@master
with:
fetch-depth: 0

- name: Use Node.js 15.x
uses: actions/setup-node@v1
Expand All @@ -28,6 +30,7 @@ jobs:
- run: npm run build
- run: git config user.name github-actions
- run: git config user.email [email protected]
- run: git describe --tags --match v* > build/build_version.txt
- run: git add -A
- run: git commit -m "build GitHub Pages"
- run: git push -f origin ghpages
1 change: 1 addition & 0 deletions build-ghpages.bat
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ git checkout -b ghpages
del .gitignore
move .gitignore.ghpages .gitignore
cmd /C npm run build
git describe --tags --match v* > build/build_version.txt
git add -A
git commit -m "build GitHub Pages"
git push -f origin ghpages
Expand Down
21 changes: 21 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,20 @@ export default function App()
const dockableCtx = Dockable.useDockableInit()
const popupCtx = useRefState(() => Popup.getDefaultCtx())

const [version, setVersion] = React.useState("")

React.useEffect(() =>
{
;(async () =>
{
const versionFile = await fetch("build/build_version.txt")
const versionTxt = await versionFile.text()
if (versionTxt.startsWith("v0-"))
setVersion("v0." + versionTxt.match(".*?\-(.*?)\-")![1])
})()

}, [])


React.useEffect(() =>
{
Expand Down Expand Up @@ -91,6 +105,13 @@ export default function App()
}}>
How to use the app
</a>
<span style={{
color: "#aaa",
alignSelf: "center",
marginLeft: "1em",
}}>
{ version }
</span>
</Menubar.Root>

{ !Playback.global.synthLoading ? null :
Expand Down

0 comments on commit 8565e22

Please sign in to comment.