mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2026-04-04 14:37:24 +02:00
chore: bump version to 1.113.3 and update versioning process
This commit is contained in:
parent
bbd3a907c2
commit
274e992799
7 changed files with 96 additions and 83 deletions
68
.github/workflows/bump-version.yml
vendored
Normal file
68
.github/workflows/bump-version.yml
vendored
Normal file
|
|
@ -0,0 +1,68 @@
|
||||||
|
name: Bump version on PR merge
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches: [master]
|
||||||
|
types: [closed]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
bump:
|
||||||
|
# Only run when the PR was actually merged (not just closed)
|
||||||
|
if: github.event.pull_request.merged == true
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v5
|
||||||
|
with:
|
||||||
|
# fetch-depth 2 so git diff HEAD~1 HEAD works for detecting changed files
|
||||||
|
fetch-depth: 2
|
||||||
|
# Use a token so the pushed commit triggers deploy.yml
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Set up Node
|
||||||
|
uses: actions/setup-node@v6
|
||||||
|
with:
|
||||||
|
node-version: lts/*
|
||||||
|
cache: npm
|
||||||
|
|
||||||
|
- name: Determine bump type from PR labels
|
||||||
|
id: bump
|
||||||
|
run: |
|
||||||
|
LABELS='${{ toJSON(github.event.pull_request.labels.*.name) }}'
|
||||||
|
if echo "$LABELS" | grep -q '"major"'; then
|
||||||
|
echo "type=major" >> "$GITHUB_OUTPUT"
|
||||||
|
elif echo "$LABELS" | grep -q '"minor"'; then
|
||||||
|
echo "type=minor" >> "$GITHUB_OUTPUT"
|
||||||
|
else
|
||||||
|
echo "type=patch" >> "$GITHUB_OUTPUT"
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Run version bump script
|
||||||
|
run: node scripts/bump-version.js ${{ steps.bump.outputs.type }}
|
||||||
|
|
||||||
|
- name: Commit and push bump
|
||||||
|
run: |
|
||||||
|
NEW_VERSION=$(node -e "
|
||||||
|
const m = require('fs')
|
||||||
|
.readFileSync('public/versioning.js', 'utf8')
|
||||||
|
.match(/const VERSION = \"([\d.]+)\"/);
|
||||||
|
console.log(m[1]);
|
||||||
|
")
|
||||||
|
|
||||||
|
git config user.name "github-actions[bot]"
|
||||||
|
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||||
|
git add .
|
||||||
|
|
||||||
|
# Only commit if something actually changed
|
||||||
|
if ! git diff --cached --quiet; then
|
||||||
|
git commit -m "chore: bump version to $NEW_VERSION"
|
||||||
|
git push
|
||||||
|
echo "Pushed version bump → $NEW_VERSION"
|
||||||
|
else
|
||||||
|
echo "Nothing changed, skipping commit."
|
||||||
|
fi
|
||||||
4
package-lock.json
generated
4
package-lock.json
generated
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "fantasy-map-generator",
|
"name": "fantasy-map-generator",
|
||||||
"version": "1.113.6",
|
"version": "1.113.3",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "fantasy-map-generator",
|
"name": "fantasy-map-generator",
|
||||||
"version": "1.113.6",
|
"version": "1.113.3",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"alea": "^1.0.1",
|
"alea": "^1.0.1",
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "fantasy-map-generator",
|
"name": "fantasy-map-generator",
|
||||||
"version": "1.113.10",
|
"version": "1.113.3",
|
||||||
"description": "Azgaar's _Fantasy Map Generator_ is a free web application that helps fantasy writers, game masters, and cartographers create and edit fantasy maps.",
|
"description": "Azgaar's _Fantasy Map Generator_ is a free web application that helps fantasy writers, game masters, and cartographers create and edit fantasy maps.",
|
||||||
"homepage": "https://github.com/Azgaar/Fantasy-Map-Generator#readme",
|
"homepage": "https://github.com/Azgaar/Fantasy-Map-Generator#readme",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
|
|
|
||||||
|
|
@ -5,15 +5,18 @@
|
||||||
* We use Semantic Versioning: major.minor.patch. Refer to https://semver.org
|
* We use Semantic Versioning: major.minor.patch. Refer to https://semver.org
|
||||||
* Our .map file format is considered the public API.
|
* Our .map file format is considered the public API.
|
||||||
*
|
*
|
||||||
* Update the version MANUALLY on each merge to main:
|
* Update the version on each merge to main:
|
||||||
* 1. MAJOR version: Incompatible changes that break existing maps
|
* 1. MAJOR version: Incompatible changes that break existing maps
|
||||||
* 2. MINOR version: Additions or changes that are backward-compatible but may require old .map files to be updated
|
* 2. MINOR version: Additions or changes that are backward-compatible but may require old .map files to be updated
|
||||||
* 3. PATCH version: Backward-compatible bug fixes and small features that do not affect the .map file format
|
* 3. PATCH version: Backward-compatible bug fixes and small features that don't affect the .map file format
|
||||||
*
|
*
|
||||||
* Example: 1.102.2 -> Major version 1, Minor version 102, Patch version 2
|
* Example: 1.102.2 -> Major version 1, Minor version 102, Patch version 2
|
||||||
|
* Version bumping is automated via GitHub Actions on PR merge.
|
||||||
|
*
|
||||||
|
* For the changes that may be interesting to end users, update the `latestPublicChanges` array below (new changes on top).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const VERSION = "1.113.10";
|
const VERSION = "1.113.3";
|
||||||
if (parseMapVersion(VERSION) !== VERSION) alert("versioning.js: Invalid format or parsing function");
|
if (parseMapVersion(VERSION) !== VERSION) alert("versioning.js: Invalid format or parsing function");
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
@ -26,6 +29,22 @@ if (parseMapVersion(VERSION) !== VERSION) alert("versioning.js: Invalid format o
|
||||||
setTimeout(showUpdateWindow, 6000);
|
setTimeout(showUpdateWindow, 6000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const latestPublicChanges = [
|
||||||
|
"Search input in Overview dialogs",
|
||||||
|
"Custom burg grouping and icon selection",
|
||||||
|
"Ability to set custom image as Marker or Regiment icon",
|
||||||
|
"Submap and Transform tools rework",
|
||||||
|
"Azgaar Bot to answer questions and provide help",
|
||||||
|
"Labels: ability to set letter spacing",
|
||||||
|
"Zones performance improvement",
|
||||||
|
"Notes Editor: on-demand AI text generation",
|
||||||
|
"New style preset: Dark Seas",
|
||||||
|
"New routes generation algorithm",
|
||||||
|
"Routes overview tool",
|
||||||
|
"Configurable longitude",
|
||||||
|
"Export zones to GeoJSON"
|
||||||
|
];
|
||||||
|
|
||||||
function showUpdateWindow() {
|
function showUpdateWindow() {
|
||||||
const changelog = "https://github.com/Azgaar/Fantasy-Map-Generator/wiki/Changelog";
|
const changelog = "https://github.com/Azgaar/Fantasy-Map-Generator/wiki/Changelog";
|
||||||
const reddit = "https://www.reddit.com/r/FantasyMapGenerator";
|
const reddit = "https://www.reddit.com/r/FantasyMapGenerator";
|
||||||
|
|
@ -37,19 +56,7 @@ if (parseMapVersion(VERSION) !== VERSION) alert("versioning.js: Invalid format o
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<strong>Latest changes:</strong>
|
<strong>Latest changes:</strong>
|
||||||
<li>Search input in Overview dialogs</li>
|
${latestPublicChanges.map(change => `<li>${change}</li>`).join("")}
|
||||||
<li>Custom burg grouping and icon selection</li>
|
|
||||||
<li>Ability to set custom image as Marker or Regiment icon</li>
|
|
||||||
<li>Submap and Transform tools rework</li>
|
|
||||||
<li>Azgaar Bot to answer questions and provide help</li>
|
|
||||||
<li>Labels: ability to set letter spacing</li>
|
|
||||||
<li>Zones performance improvement</li>
|
|
||||||
<li>Notes Editor: on-demand AI text generation</li>
|
|
||||||
<li>New style preset: Dark Seas</li>
|
|
||||||
<li>New routes generation algorithm</li>
|
|
||||||
<li>Routes overview tool</li>
|
|
||||||
<li>Configurable longitude</li>
|
|
||||||
<li>Export zones to GeoJSON</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<p>Join our <a href="${discord}" target="_blank">Discord server</a> and <a href="${reddit}" target="_blank">Reddit community</a> to ask questions, share maps, discuss the Generator and Worlbuilding, report bugs and propose new features.</p>
|
<p>Join our <a href="${discord}" target="_blank">Discord server</a> and <a href="${reddit}" target="_blank">Reddit community</a> to ask questions, share maps, discuss the Generator and Worlbuilding, report bugs and propose new features.</p>
|
||||||
|
|
|
||||||
|
|
@ -12,8 +12,8 @@
|
||||||
* Usage:
|
* Usage:
|
||||||
* node scripts/bump-version.js # interactive prompt
|
* node scripts/bump-version.js # interactive prompt
|
||||||
* node scripts/bump-version.js patch # non-interactive
|
* node scripts/bump-version.js patch # non-interactive
|
||||||
* node scripts/bump-version.js minor
|
* node scripts/bump-version.js minor # non-interactive
|
||||||
* node scripts/bump-version.js major
|
* node scripts/bump-version.js major # non-interactive
|
||||||
* node scripts/bump-version.js --dry-run # preview only, no writes
|
* node scripts/bump-version.js --dry-run # preview only, no writes
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,33 +0,0 @@
|
||||||
#!/usr/bin/env node
|
|
||||||
// Installs scripts/pre-push as .git/hooks/pre-push.
|
|
||||||
// Runs automatically via the `prepare` npm lifecycle hook (npm install).
|
|
||||||
|
|
||||||
const fs = require("fs");
|
|
||||||
const path = require("path");
|
|
||||||
|
|
||||||
const repoRoot = path.resolve(__dirname, "..");
|
|
||||||
const hooksDir = path.join(repoRoot, ".git", "hooks");
|
|
||||||
const source = path.join(repoRoot, "scripts", "pre-push");
|
|
||||||
const target = path.join(hooksDir, "pre-push");
|
|
||||||
|
|
||||||
if (!fs.existsSync(path.join(repoRoot, ".git"))) {
|
|
||||||
// Not a git repo (e.g. Docker / CI build from tarball) — skip silently.
|
|
||||||
process.exit(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!fs.existsSync(hooksDir)) {
|
|
||||||
fs.mkdirSync(hooksDir, {recursive: true});
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
// Symlink so changes to scripts/pre-push are reflected immediately.
|
|
||||||
if (fs.existsSync(target) || fs.lstatSync(target).isSymbolicLink()) {
|
|
||||||
fs.unlinkSync(target);
|
|
||||||
}
|
|
||||||
} catch {
|
|
||||||
// Target doesn't exist yet — that's fine.
|
|
||||||
}
|
|
||||||
|
|
||||||
fs.symlinkSync(source, target);
|
|
||||||
fs.chmodSync(source, 0o755);
|
|
||||||
console.log("[prepare] Installed git pre-push hook → .git/hooks/pre-push");
|
|
||||||
|
|
@ -1,29 +0,0 @@
|
||||||
#!/usr/bin/env sh
|
|
||||||
# Git pre-push hook — automatically bumps the version before pushing.
|
|
||||||
# Installed by: npm run prepare (scripts/install-hooks.js)
|
|
||||||
#
|
|
||||||
# Prompts for patch / minor / major (default: patch), updates:
|
|
||||||
# - public/versioning.js
|
|
||||||
# - package.json
|
|
||||||
# - src/index.html (cache-busting ?v= hashes for changed modules)
|
|
||||||
# then commits those changes so they are included in the push.
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
REPO_ROOT="$(git rev-parse --show-toplevel)"
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
node "$REPO_ROOT/scripts/bump-version.js"
|
|
||||||
|
|
||||||
# Stage files that may have been modified by the bump
|
|
||||||
git add \
|
|
||||||
"$REPO_ROOT/public/versioning.js" \
|
|
||||||
"$REPO_ROOT/package.json" \
|
|
||||||
"$REPO_ROOT/src/index.html" 2>/dev/null || true
|
|
||||||
|
|
||||||
# Only commit if there are staged changes from the bump
|
|
||||||
if ! git diff --cached --quiet; then
|
|
||||||
NEW_VERSION=$(node -e "const f=require('fs');const m=f.readFileSync('$REPO_ROOT/public/versioning.js','utf8').match(/const VERSION = \"([\d.]+)\"/);console.log(m[1])")
|
|
||||||
git commit -m "chore: bump version to $NEW_VERSION"
|
|
||||||
echo "[pre-push] Committed version bump → $NEW_VERSION"
|
|
||||||
fi
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue