mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-01-18 23:11:11 +00:00
Allow to auto-bump the version and show version in title (#2307)
This commit is contained in:
parent
284c3c628b
commit
1583fdc4cb
9
.github/actions/bump-version/Dockerfile
vendored
Normal file
9
.github/actions/bump-version/Dockerfile
vendored
Normal file
@ -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"]
|
6
.github/actions/bump-version/action.yml
vendored
Normal file
6
.github/actions/bump-version/action.yml
vendored
Normal file
@ -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'
|
27
.github/actions/bump-version/bump-version.py
vendored
Normal file
27
.github/actions/bump-version/bump-version.py
vendored
Normal file
@ -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}')
|
3
.github/actions/bump-version/entrypoint.sh
vendored
Executable file
3
.github/actions/bump-version/entrypoint.sh
vendored
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/sh -l
|
||||||
|
|
||||||
|
python /action/workspace/bump-version.py
|
22
.github/workflows/bump-version.yml
vendored
Normal file
22
.github/workflows/bump-version.yml
vendored
Normal file
@ -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
|
@ -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`
|
2. Run `npm run start:dev` to locally run the project in `localhost:8000`
|
||||||
|
|
||||||
#### Linting
|
#### 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
|
### ❔ FAQ
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@ export default class TitleUiHandler extends OptionSelectUiHandler {
|
|||||||
private eventDisplay: TimedEventDisplay;
|
private eventDisplay: TimedEventDisplay;
|
||||||
|
|
||||||
private titleStatsTimer: NodeJS.Timeout;
|
private titleStatsTimer: NodeJS.Timeout;
|
||||||
|
private versionLabel: Phaser.GameObjects.Text;
|
||||||
|
|
||||||
constructor(scene: BattleScene, mode: Mode = Mode.TITLE) {
|
constructor(scene: BattleScene, mode: Mode = Mode.TITLE) {
|
||||||
super(scene, mode);
|
super(scene, mode);
|
||||||
@ -40,6 +41,9 @@ export default class TitleUiHandler extends OptionSelectUiHandler {
|
|||||||
this.titleContainer.add(this.eventDisplay);
|
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 = 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.playerCountLabel.setOrigin(1, 0);
|
||||||
this.titleContainer.add(this.playerCountLabel);
|
this.titleContainer.add(this.playerCountLabel);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user