mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2026-03-23 07:37:24 +01:00
Auto versioning (#1344)
* feat: implement version bumping script and pre-push hook * chore: bump version to 1.113.5 * chore: bump version to 1.113.6 * chore: bump version to 1.113.7 * chore: bump version to 1.113.8 * chore: bump version to 1.113.9 * chore: bump version to 1.113.10 * chore: bump version to 1.113.3 and update versioning process * chore: enhance version bump process with base version check * Update .github/workflows/bump-version.yml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update .github/workflows/bump-version.yml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * fix: sync package-lock.json version fields during automated version bump (#1345) * Initial plan * fix: update package-lock.json version fields during version bump Co-authored-by: Azgaar <26469650+Azgaar@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Azgaar <26469650+Azgaar@users.noreply.github.com> * Fix branch name in versioning.js comment: 'main' → 'master' (#1346) * Initial plan * fix: update branch name in versioning.js comment from 'main' to 'master' Co-authored-by: Azgaar <26469650+Azgaar@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Azgaar <26469650+Azgaar@users.noreply.github.com> * Extend bump-version.js to update ?v= cache-busting hashes in public/**/*.js dynamic imports (#1347) * Initial plan * feat: extend bump-version.js to update ?v= hashes in public/**/*.js dynamic imports Co-authored-by: Azgaar <26469650+Azgaar@users.noreply.github.com> * chore: merge base branch changes (package-lock.json sync, RELEASE_BOT_TOKEN, node 24.x, comment fix) Co-authored-by: Azgaar <26469650+Azgaar@users.noreply.github.com> * Update scripts/bump-version.js Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update scripts/bump-version.js Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Azgaar <26469650+Azgaar@users.noreply.github.com> Co-authored-by: Azgaar <maxganiev@yandex.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * refactor: streamline dynamic import hash updates for public JS files * refactor: enhance version bump detection using AI analysis of PR diffs * Auto versioning (#1348) * Initial plan * fix: add ref to checkout step and stage public/**/*.js in bump workflow Co-authored-by: Azgaar <26469650+Azgaar@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Azgaar <26469650+Azgaar@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: Azgaar <26469650+Azgaar@users.noreply.github.com>
This commit is contained in:
parent
a66b60b5a7
commit
d7555ff1b2
6 changed files with 601 additions and 19 deletions
83
.github/workflows/bump-version.yml
vendored
Normal file
83
.github/workflows/bump-version.yml
vendored
Normal file
|
|
@ -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 }}
|
||||
|
||||
- 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue