Add frontend version management and display
This commit is contained in:
36
deploy.sh
36
deploy.sh
@@ -130,6 +130,24 @@ check_github_token() {
|
||||
fi
|
||||
}
|
||||
|
||||
update_version_file() {
|
||||
print_header "Updating Version File"
|
||||
|
||||
local version_file="./frontend/VERSION"
|
||||
local current_version=""
|
||||
|
||||
# Check if version file exists
|
||||
if [ -f "$version_file" ]; then
|
||||
current_version=$(cat "$version_file")
|
||||
print_info "Current version: $current_version"
|
||||
fi
|
||||
|
||||
# Update version file with new version (strip 'v' prefix if present)
|
||||
local new_version="${VERSION#v}"
|
||||
echo "$new_version" > "$version_file"
|
||||
print_success "Updated version file to: $new_version"
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
# Build Functions
|
||||
##############################################################################
|
||||
@@ -350,11 +368,18 @@ print_summary() {
|
||||
echo "GitHub User: ${GITHUB_USER}"
|
||||
echo "Version: ${VERSION}"
|
||||
echo ""
|
||||
echo "Version Management:"
|
||||
echo " Frontend version file updated: ./frontend/VERSION"
|
||||
echo " Version displayed in footer: v${VERSION#v}"
|
||||
echo ""
|
||||
echo "Next Steps:"
|
||||
echo " 1. Pull images: docker pull ${BACKEND_IMAGE}"
|
||||
echo " 2. Configure production secrets (JWT_SECRET)"
|
||||
echo " 3. Set environment variables (CORS_ORIGIN, ALLOW_REGISTRATION)"
|
||||
echo " 4. Deploy: docker-compose -f docker-compose.prod.deployed.yml up -d"
|
||||
echo " 1. Commit version update:"
|
||||
echo " git add frontend/VERSION"
|
||||
echo " git commit -m \"Bump version to ${VERSION#v}\""
|
||||
echo " 2. Pull images: docker pull ${BACKEND_IMAGE}"
|
||||
echo " 3. Configure production secrets (JWT_SECRET)"
|
||||
echo " 4. Set environment variables (CORS_ORIGIN, ALLOW_REGISTRATION)"
|
||||
echo " 5. Deploy: docker-compose -f docker-compose.prod.deployed.yml up -d"
|
||||
echo ""
|
||||
}
|
||||
|
||||
@@ -377,6 +402,9 @@ main() {
|
||||
# Check token
|
||||
check_github_token
|
||||
|
||||
# Update version file
|
||||
update_version_file
|
||||
|
||||
# Build images
|
||||
build_backend
|
||||
build_frontend
|
||||
|
||||
@@ -31,6 +31,9 @@ COPY ./public /usr/share/nginx/html
|
||||
# Copy compiled CSS to nginx
|
||||
COPY --from=builder /app/css/styles.css /usr/share/nginx/html/css/styles.css
|
||||
|
||||
# Copy version file
|
||||
COPY ./VERSION /usr/share/nginx/html/version.txt
|
||||
|
||||
# Expose ports
|
||||
EXPOSE 80 443
|
||||
|
||||
|
||||
1
frontend/VERSION
Normal file
1
frontend/VERSION
Normal file
@@ -0,0 +1 @@
|
||||
1.0.8
|
||||
@@ -7,5 +7,26 @@
|
||||
<p class="text-gray-500 text-sm mt-2">
|
||||
Built with Fastify, SQLite, and Alpine.js
|
||||
</p>
|
||||
<p class="text-gray-600 text-xs mt-3" id="version-footer">
|
||||
<!-- Version loaded dynamically -->
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<script>
|
||||
// Load and display version in footer
|
||||
(async function loadVersion() {
|
||||
try {
|
||||
const response = await fetch('/version.txt');
|
||||
if (response.ok) {
|
||||
const version = await response.text();
|
||||
const versionEl = document.getElementById('version-footer');
|
||||
if (versionEl) {
|
||||
versionEl.textContent = `v${version.trim()}`;
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.debug('Version file not available');
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user