Skip to content

Commit

Permalink
Merge pull request #137 from secretin/introduce_app_commitish
Browse files Browse the repository at this point in the history
add secretin-app comittish
  • Loading branch information
agix authored Mar 21, 2022
2 parents be51bb7 + cc2125d commit e7958d7
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions public/app-version.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
const SECRETIN_APP_COMMIT = 'master';
1 change: 1 addition & 0 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<!-- <link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico"> -->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<title>Secret-in</title>
<script src="%PUBLIC_URL%/app-version.js"></script>
</head>
<body style="background-color: #fafafa">
<%= require('fs').readFileSync('src/icons.svg') %>
Expand Down
2 changes: 2 additions & 0 deletions scripts/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,7 @@ SKIP_PREFLIGHT_CHECK=true REACT_APP_API_SECRETIN=https://api.secret-in.me yarn r
echo "Pre-deploy tasks..."
cp build/index.html build/404.html

echo "const SECRETIN_APP_COMMIT = '$(git rev-parse HEAD)';" > build/app-version.js

echo "Deploying..."
./node_modules/.bin/gh-pages -d build
22 changes: 22 additions & 0 deletions src/components/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,27 @@ class App extends Component {
}

render() {
// eslint-disable-next-line no-undef
const shortCommit = SECRETIN_APP_COMMIT
? // eslint-disable-next-line no-undef
SECRETIN_APP_COMMIT.substr(0, 7)
: '';
// eslint-disable-next-line no-undef
const secretinAppVersion = SECRETIN_APP_COMMIT ? (
<span className="secretin-version">
secretin-app{' '}
<a
// eslint-disable-next-line no-undef
href={`https://github.com/secretin/secretin-app/commit/${SECRETIN_APP_COMMIT}`}
rel="noopener noreferrer"
target="_blank"
>
{shortCommit}
</a>
</span>
) : (
<span className="secretin-version">secretin-app dev</span>
);
return (
<Router basename={process.env.PUBLIC_URL}>
<div className="App">
Expand All @@ -89,6 +110,7 @@ class App extends Component {
<span className="secretin-version">
secretin-lib v{Secretin.version}
</span>
{secretinAppVersion}
</div>
</Router>
);
Expand Down

0 comments on commit e7958d7

Please sign in to comment.