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
83 changes: 83 additions & 0 deletions .github/workflows/bump-version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
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:
# Check out the base branch (master) so we are on a real branch, not
# a detached PR merge ref, which makes git push work without arguments.
ref: ${{ github.event.pull_request.base.ref }}
# fetch-depth 2 so HEAD~1 resolves to the pre-merge master commit
fetch-depth: 2
# Use a PAT so the pushed bump commit can trigger deploy.yml
token: ${{ secrets.RELEASE_BOT_TOKEN }}

Comment thread
Azgaar marked this conversation as resolved.
- name: Set up Node
uses: actions/setup-node@v6
with:
node-version: "24.x"
cache: npm

- name: Get PR diff
run: git diff HEAD~1 HEAD > /tmp/pr.diff

- name: AI-detect bump type from diff
id: bump
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TYPE=$(node scripts/detect-bump-type.js --diff-file /tmp/pr.diff)
echo "type=$TYPE" >> "$GITHUB_OUTPUT"
echo "AI-determined bump type: $TYPE"

- name: Extract base version (master before this PR merged)
id: base
run: |
BASE=$(git show HEAD~1:public/versioning.js \
| grep -oP 'const VERSION = "\K[\d.]+')
echo "version=$BASE" >> "$GITHUB_OUTPUT"
echo "Base version: $BASE"

- name: Run version bump script
run: |
node scripts/bump-version.js ${{ steps.bump.outputs.type }} \
--base-version ${{ steps.base.outputs.version }}

- 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"
# Stage versioning files + any public/**/*.js whose dynamic import
# hashes may have been refreshed by updatePublicJsDynamicImportHashes
git add public/versioning.js package.json package-lock.json src/index.html
git add public/ 2>/dev/null || true

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
10 changes: 8 additions & 2 deletions package-lock.json

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

4 changes: 3 additions & 1 deletion public/modules/dynamic/supporters.js
Original file line number Diff line number Diff line change
Expand Up @@ -606,4 +606,6 @@ dr_not_sam
Mie96
Riley
Amber Davis
tomtom1969vlbg`;
tomtom1969vlbg
Eric Knight
Adeline Lefizelier`;
39 changes: 23 additions & 16 deletions public/versioning.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,18 @@
* We use Semantic Versioning: major.minor.patch. Refer to https://semver.org
* 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 master:
* 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
* 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
* 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.4";
const VERSION = "1.113.3";
if (parseMapVersion(VERSION) !== VERSION) alert("versioning.js: Invalid format or parsing function");

{
Expand All @@ -26,6 +29,22 @@ if (parseMapVersion(VERSION) !== VERSION) alert("versioning.js: Invalid format o
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() {
const changelog = "https://github.com/Azgaar/Fantasy-Map-Generator/wiki/Changelog";
const reddit = "https://www.reddit.com/r/FantasyMapGenerator";
Expand All @@ -37,19 +56,7 @@ if (parseMapVersion(VERSION) !== VERSION) alert("versioning.js: Invalid format o

<ul>
<strong>Latest changes:</strong>
<li>Search input in Overview dialogs</li>
<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>
${latestPublicChanges.map(change => `<li>${change}</li>`).join("")}
</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>
Expand Down
Loading
Loading