Skip to content

Commit

Permalink
Merge pull request #80 from OpenGeoscience/version-tag
Browse files Browse the repository at this point in the history
Version Tags
  • Loading branch information
annehaley authored Nov 6, 2024
2 parents 30fc1a3 + 7f6ce9d commit ca68690
Show file tree
Hide file tree
Showing 7 changed files with 118 additions and 3 deletions.
1 change: 1 addition & 0 deletions docker-compose.override.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ services:
working_dir: /web
volumes:
- ./web:/web
- ./.git:/web/.git # allow fetching version tag
ports:
- 8080:8080
environment:
Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,6 @@ quote-style = "single"
[tool.ruff.lint.isort]
force-sort-within-sections = true # Sort by name, don't cluster "from" vs "import"
combine-as-imports = true # Combines "as" imports on the same line

[tool.semantic_release]
version_variables = ["setup.py:__version__", "web/package.json:version"]
4 changes: 3 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

from setuptools import find_packages, setup

__version__ = '0.4.1'

readme_file = Path(__file__).parent / 'README.md'
if readme_file.exists():
with readme_file.open() as f:
Expand All @@ -12,7 +14,7 @@

setup(
name='uvdat',
version='0.1.0',
version=__version__,
description='',
long_description=long_description,
long_description_content_type='text/markdown',
Expand Down
53 changes: 53 additions & 0 deletions web/package-lock.json

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

1 change: 1 addition & 0 deletions web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"axios": "^1.4.0",
"buffer": "^6.0.3",
"core-js": "^3.8.3",
"git-describe": "^4.1.1",
"lodash": "^4.17.21",
"maplibre-gl": "^4.6.0",
"shpjs": "^4.0.4",
Expand Down
54 changes: 52 additions & 2 deletions web/src/App.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts">
import { defineComponent, ref, watch, onMounted, computed } from "vue";
import { defineComponent, ref, Ref, watch, onMounted, computed } from "vue";
import {
currentUser,
currentError,
Expand Down Expand Up @@ -31,13 +31,22 @@ export default defineComponent({
setup() {
const drawer = ref(true);
const showError = computed(() => currentError.value !== undefined);
const version = process.env.VUE_APP_VERSION;
const hash = process.env.VUE_APP_HASH;
const copied: Ref<string | undefined> = ref();
function onReady() {
if (currentUser.value) {
loadProjects();
}
}
function copyToClipboard(content: string) {
navigator.clipboard.writeText(content).then(() => {
copied.value = content;
});
}
const login = () => {
oauthClient.redirectToLogin();
};
Expand All @@ -49,6 +58,9 @@ export default defineComponent({
return {
login,
logout,
version,
hash,
copied,
currentUser,
drawer,
currentProject,
Expand All @@ -59,6 +71,7 @@ export default defineComponent({
currentChart,
currentSimulationType,
projectConfigMode,
copyToClipboard,
};
},
});
Expand Down Expand Up @@ -103,7 +116,44 @@ export default defineComponent({
@click.stop="drawer = !drawer"
v-if="!projectConfigMode"
/>
<v-toolbar-title>UVDAT</v-toolbar-title>
<v-toolbar-title>
UVDAT
<v-menu
activator="parent"
:open-on-hover="true"
:close-on-content-click="false"
@update:model-value="copied = undefined"
>
<v-card class="pa-3" style="width: fit-content">
<v-card-subtitle>
<a
href="https://github.com/OpenGeoscience/uvdat"
target="_blank"
style="text-decoration: none"
>
<v-icon icon="mdi-github" />
Source
</a>
</v-card-subtitle>
<v-card-subtitle>
<v-icon
:icon="copied === version ? 'mdi-check' : 'mdi-content-copy'"
:color="copied === version ? 'green' : 'black'"
@click="copyToClipboard(version)"
/>
Version: {{ version }}
</v-card-subtitle>
<v-card-subtitle>
<v-icon
:icon="copied === hash ? 'mdi-check' : 'mdi-content-copy'"
:color="copied === hash ? 'green' : 'black'"
@click="copyToClipboard(hash)"
/>
Hash: {{ hash }}
</v-card-subtitle>
</v-card>
</v-menu>
</v-toolbar-title>
<v-spacer />
<div v-if="currentUser" class="px-3">
{{ currentUser.first_name }}
Expand Down
5 changes: 5 additions & 0 deletions web/vue.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
const { ProvidePlugin } = require("webpack");

const { gitDescribeSync } = require("git-describe");
const describe = gitDescribeSync();
process.env.VUE_APP_VERSION = describe.dirty ? describe.raw : describe.tag;
process.env.VUE_APP_HASH = describe.hash;

module.exports = {
transpileDependencies: true,
configureWebpack: {
Expand Down

0 comments on commit ca68690

Please sign in to comment.