diff --git a/.github/actions/bump-version/Dockerfile b/.github/actions/bump-version/Dockerfile new file mode 100644 index 00000000000..22207213c56 --- /dev/null +++ b/.github/actions/bump-version/Dockerfile @@ -0,0 +1,9 @@ +FROM python:3.12-slim + +# Set the working directory +WORKDIR /action/workspace + +# Copy the script into the container +COPY . /action/workspace/ + +ENTRYPOINT ["/action/workspace/entrypoint.sh"] diff --git a/.github/actions/bump-version/action.yml b/.github/actions/bump-version/action.yml new file mode 100644 index 00000000000..8f9284cedbb --- /dev/null +++ b/.github/actions/bump-version/action.yml @@ -0,0 +1,6 @@ +name: "Auto-Bump Version File" +author: "Franck Trouillez" +description: "Automatically bump the package.json and package-file.json file." +runs: + using: 'docker' + image: 'Dockerfile' diff --git a/.github/actions/bump-version/bump-version.py b/.github/actions/bump-version/bump-version.py new file mode 100644 index 00000000000..09c7c522f0a --- /dev/null +++ b/.github/actions/bump-version/bump-version.py @@ -0,0 +1,27 @@ +import json + +# Read package.json +with open('package.json', 'r') as package_file: + package_data = json.load(package_file) + +# Read package-lock.json +with open('package-lock.json', 'r') as lock_file: + lock_data = json.load(lock_file) + +# Bump version +version = package_data['version'] +version_parts = version.split('.') +version_parts[-1] = str(int(version_parts[-1]) + 1) +new_version = '.'.join(version_parts) + +# Update package.json +package_data['version'] = new_version +with open('package.json', 'w') as package_file: + json.dump(package_data, package_file, indent=2) + +# Update package-lock.json +lock_data['version'] = new_version +with open('package-lock.json', 'w') as lock_file: + json.dump(lock_data, lock_file, indent=2) + +print(f'Version bumped to {new_version}') diff --git a/.github/actions/bump-version/entrypoint.sh b/.github/actions/bump-version/entrypoint.sh new file mode 100755 index 00000000000..94a90a5ebe6 --- /dev/null +++ b/.github/actions/bump-version/entrypoint.sh @@ -0,0 +1,3 @@ +#!/bin/sh -l + +python /action/workspace/bump-version.py diff --git a/.github/workflows/bump-version.yml b/.github/workflows/bump-version.yml new file mode 100644 index 00000000000..570d851c4e6 --- /dev/null +++ b/.github/workflows/bump-version.yml @@ -0,0 +1,22 @@ +name: Bump version +on: + workflow_dispatch: + push: + branches: + - main + +jobs: + bump-version: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Bump version file + uses: ./.github/actions/bump-version + - name: Commit and push + run: | + git config --local user.email "auto-bump-version@github-actions.com" + git config --local user.name "Auto Bump Version Action" + git add . + git commit -m "[ABV] Bump version" + git push diff --git a/README.md b/README.md index d1b46e630bf..6f68ce786f9 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,10 @@ If you have the motivation and experience with Typescript/Javascript (or are wil 2. Run `npm run start:dev` to locally run the project in `localhost:8000` #### Linting -We're using ESLint as our common linter and formatter. It will run automatically during the pre-commit hook but if you would like to manually run it, use the `npm run eslint` script. +We're using ESLint as our common linter and formatter. It will run automatically during the pre-commit hook but if you would like to manually run it, use the `npm run eslint` script. + +#### Version management +If you're making a bigger change, it is recommended to bump the minor version in the `package.json` file. If you're making an even bigger change, bump the major version. Patch versions are bumped automatically by the CI/CD pipeline. ### ❔ FAQ diff --git a/src/ui/title-ui-handler.ts b/src/ui/title-ui-handler.ts index 4036e0b9922..fef200df960 100644 --- a/src/ui/title-ui-handler.ts +++ b/src/ui/title-ui-handler.ts @@ -15,6 +15,7 @@ export default class TitleUiHandler extends OptionSelectUiHandler { private eventDisplay: TimedEventDisplay; private titleStatsTimer: NodeJS.Timeout; + private versionLabel: Phaser.GameObjects.Text; constructor(scene: BattleScene, mode: Mode = Mode.TITLE) { super(scene, mode); @@ -40,6 +41,9 @@ export default class TitleUiHandler extends OptionSelectUiHandler { this.titleContainer.add(this.eventDisplay); } + this.versionLabel = addTextObject(this.scene, 0, 0, this.scene.game.config.gameVersion, TextStyle.MESSAGE, { fontSize: "54px" }); + this.titleContainer.add(this.versionLabel); + this.playerCountLabel = addTextObject(this.scene, (this.scene.game.canvas.width / 6) - 2, (this.scene.game.canvas.height / 6) - 109, `? ${i18next.t("menu:playersOnline")}`, TextStyle.MESSAGE, { fontSize: "54px" }); this.playerCountLabel.setOrigin(1, 0); this.titleContainer.add(this.playerCountLabel);