Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 35 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,21 +76,55 @@ jobs:
VERSION=$(node -p "require('./package.json').version")
echo "version=$VERSION" >> "$GITHUB_OUTPUT"

- name: Update docs version
run: |
VERSION=${{ steps.get_version.outputs.version }}
export VERSION
node - <<'EOF'
const fs = require('fs');
const version = process.env.VERSION;

// update backend api JSON docs
const jsonPath = 'backend/docs/api-documentation.json';
if (fs.existsSync(jsonPath)) {
const doc = JSON.parse(fs.readFileSync(jsonPath, 'utf8'));
doc.info = doc.info || {};
doc.info.version = version;
fs.writeFileSync(jsonPath, JSON.stringify(doc, null, 2));
}

// update any README files with Version: lines
const updateReadme = (p) => {
if (fs.existsSync(p)) {
let c = fs.readFileSync(p, 'utf8');
c = c.replace(/\*\*Version:\*\* .*/, `**Version:** ${version}`);
fs.writeFileSync(p, c);
}
};
updateReadme('backend/docs/README.md');
updateReadme('README.md');
updateReadme('frontend/README.md');
EOF

- name: Commit version changes
id: commit_versions
run: |
FILES=""
if [ -f package.json ]; then FILES="$FILES package.json"; fi
if [ -f frontend/package.json ]; then FILES="$FILES frontend/package.json"; fi
if [ -f backend/package.json ]; then FILES="$FILES backend/package.json"; fi
if [ -f backend/docs/api-documentation.json ]; then FILES="$FILES backend/docs/api-documentation.json"; fi
if [ -f backend/docs/README.md ]; then FILES="$FILES backend/docs/README.md"; fi
if [ -f README.md ]; then FILES="$FILES README.md"; fi
if [ -f frontend/README.md ]; then FILES="$FILES frontend/README.md"; fi
if [ -n "$FILES" ]; then git add $FILES; fi

if git diff --cached --quiet; then
echo "did_commit=false" >> $GITHUB_OUTPUT
exit 0
fi

git commit -m "chore: bump versions for ${{ github.event.inputs.release_type }} release"
git commit -m "chore: bump versions for ${{ github.event.inputs.release_type }} v${{ steps.get_version.outputs.version }} release"
# Check if tag already exists
TAG_NAME="v${{ steps.get_version.outputs.version }}"
did_commit=false
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# 🛠️ dkutils — The Ultimate Multi-Utility Platform

**Version:** 2.0.1

![dkutils Logo](frontend/public/logo.png)

[![License: ISC](https://img.shields.io/badge/License-ISC-blue.svg)](https://opensource.org/licenses/ISC)
Expand Down
Loading