feat(doc): changelog system (#6350)

This system provides rules and automatizes (Deno-typescript) the creation of a changelog file to help developers to adapt their code and know what is new with every (pre)release
This commit is contained in:
Yehonal 2021-06-15 11:04:29 +02:00 committed by GitHub
parent 067eb82302
commit 3f70d0b80f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 1447 additions and 19 deletions

View File

@ -6,3 +6,12 @@ tab_width = 4
insert_final_newline = true
trim_trailing_whitespace = true
max_line_length = 80
[*.{json,ts,js}]
charset = utf-8
indent_style = space
indent_size = 2
tab_width = 2
insert_final_newline = true
trim_trailing_whitespace = true
max_line_length = 80

View File

@ -1,11 +1,11 @@
name: import-pending-sql
name: import-pending
on:
push:
branches:
- master
jobs:
import-pending-sql:
import-pending:
strategy:
fail-fast: false
runs-on: ubuntu-20.04
@ -20,12 +20,11 @@ jobs:
- name: Import and commit pending sql
run: |
git config user.email "azerothcorebot@gmail.com" && git config user.name "AzerothCoreBot"
cd bin/
source acore-db-pendings
cd ..
bash bin/acore-db-pendings
bash bin/acore-import-changelogs
git fetch --unshallow origin ${BRANCH}
git add -A .
git commit -am "chore(DB): import pending SQL update file" -m "Referenced commit(s): ${GITHUB_SHA}" || true
git commit -am "chore(DB): import pending files" -m "Referenced commit(s): ${GITHUB_SHA}" || true
env:
BRANCH: ${{ steps.extract_branch.outputs.branch }}
- name: Push changes

View File

@ -65,5 +65,6 @@
"codecvt": "cpp"
},
"deno.enable": true,
"deno.path" : "deps/deno/bin/deno"
"deno.path": "deps/deno/bin/deno",
"deno.lint": true
}

View File

@ -1,5 +1,5 @@
{
"name" : "azerothcore-wotlk",
"version" : "3.0.0",
"license" : "AGPL3"
"name": "azerothcore-wotlk",
"version": "4.0.0-dev.1",
"license": "AGPL3"
}

View File

@ -0,0 +1,54 @@
import * as semver from "https://deno.land/x/semver/mod.ts";
// specify the needed paths here
const CHANGELOG_PATH = "doc/changelog";
const CHANGELOG_PENDING_PATH = `${CHANGELOG_PATH}/pendings`;
const CHANGELOG_MASTER_FILE = `${CHANGELOG_PATH}/master.md`;
const ACORE_JSON = "./acore.json";
// read the acore.json file to work with the versioning
const decoder = new TextDecoder("utf-8");
const data = await Deno.readFile(ACORE_JSON);
const acoreInfo = JSON.parse(decoder.decode(data));
let changelogText = await Deno.readTextFile(CHANGELOG_MASTER_FILE);
const currentVersion = acoreInfo.version;
const res=Deno.run({ cmd: [ "git", "rev-parse",
"HEAD"],
stdout: 'piped',
stderr: 'piped',
stdin: 'null' });
await res.status();
const gitVersion = new TextDecoder().decode(await res.output());
for await (const dirEntry of Deno.readDir(CHANGELOG_PENDING_PATH)) {
if (!dirEntry.isFile || !dirEntry.name.endsWith(".md")) {
continue;
}
// Upgrade the prerelease version number (e.g. 1.0.0-dev.1 -> 1.0.0-dev.2)
acoreInfo.version = semver.inc(acoreInfo.version, "prerelease", {
includePrerelease: true,
});
// read the pending file found and add it at the beginning of the changelog text
const data = await Deno.readTextFile(
`${CHANGELOG_PENDING_PATH}/${dirEntry.name}`,
);
changelogText = `## ${acoreInfo.version} | Commit: ${gitVersion}\n\n${data}\n${changelogText}`;
// remove the pending file
await Deno.remove(`${CHANGELOG_PENDING_PATH}/${dirEntry.name}`);
}
// write to acore.json and master.md only if new version is available
if (currentVersion != acoreInfo.version) {
console.log(`Changelog version upgraded from ${currentVersion} to ${acoreInfo.version}`)
Deno.writeTextFile(CHANGELOG_MASTER_FILE, changelogText);
Deno.writeTextFile(ACORE_JSON, JSON.stringify(acoreInfo, null, 2)+"\n");
} else {
console.log("No changelogs to add")
}

View File

@ -14,14 +14,14 @@ function import() {
pendingPath="$AC_PATH_ROOT/data/sql/updates/pending_$folder"
updPath="$UPDATES_PATH/$folder"
latestUpd=`ls -1 $updPath/ | tail -n 1`
latestUpd=$(ls -1 $updPath/ | tail -n 1)
if [ -z $latestUpd ]; then
echo "FIRST UPDATE FILE MISSING!! DID YOU ARCHIVED IT?";
exit;
exit 1;
fi
dateToday=`date +%Y_%m_%d`
dateToday=$(date +%Y_%m_%d)
counter=0
dateLast=$latestUpd
@ -43,10 +43,10 @@ function import() {
newVer=$dateToday"_"$cnt
startTransaction="START TRANSACTION;";
updHeader="ALTER TABLE version_db_"$db" CHANGE COLUMN "$oldVer" "$newVer" bit;";
updHeader="ALTER TABLE version_db_$db CHANGE COLUMN $oldVer $newVer bit;";
endTransaction="COMMIT;";
newFile="$updPath/"$dateToday"_"$cnt".sql"
newFile="$updPath/$dateToday_$cnt.sql"
oldFile=$(basename "$entry")
prefix=${oldFile%_*.sql}
@ -67,7 +67,7 @@ function import() {
echo "proc:BEGIN DECLARE OK VARCHAR(100) DEFAULT 'FALSE';" >> "$newFile";
echo "SELECT COUNT(*) INTO @COLEXISTS" >> "$newFile";
echo "FROM information_schema.COLUMNS" >> "$newFile";
echo "WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'version_db_"$db"' AND COLUMN_NAME = '"$oldVer"';" >> "$newFile";
echo "WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'version_db_$db' AND COLUMN_NAME = '$oldVer';" >> "$newFile";
echo "IF @COLEXISTS = 0 THEN LEAVE proc; END IF;" >> "$newFile";
fi
@ -75,7 +75,7 @@ function import() {
echo "$updHeader" >> "$newFile";
if [[ $isRev -eq 1 ]]; then
echo "SELECT sql_rev INTO OK FROM version_db_"$db" WHERE sql_rev = '$rev'; IF OK <> 'FALSE' THEN LEAVE proc; END IF;" >> "$newFile";
echo "SELECT sql_rev INTO OK FROM version_db_$db WHERE sql_rev = '$rev'; IF OK <> 'FALSE' THEN LEAVE proc; END IF;" >> "$newFile";
fi;
echo "--" >> "$newFile";
@ -89,7 +89,7 @@ function import() {
echo "--" >> "$newFile";
echo "-- END UPDATING QUERIES" >> "$newFile";
echo "--" >> "$newFile";
echo "UPDATE version_db_"$db" SET date = '"$newVer"' WHERE sql_rev = '"$rev"';" >> "$newFile";
echo "UPDATE version_db_$db SET date = '$newVer' WHERE sql_rev = '$rev';" >> "$newFile";
echo "$endTransaction" >> "$newFile";

View File

@ -264,7 +264,7 @@ function shellCommandFactory(
)
}"\n`,
)
.action(async (args: any[] | undefined) => {
.action(async (args: string[] | undefined) => {
const { run } = Deno;
for (const command of commands) {

7
bin/acore-import-changelogs Executable file
View File

@ -0,0 +1,7 @@
#!/usr/bin/env bash
CUR_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "$CUR_PATH/../apps/bash_shared/includes.sh"
denoRunFile "$CUR_PATH/../apps/ci/ci-pending-changelogs.ts"

8
doc/changelog/README.md Normal file
View File

@ -0,0 +1,8 @@
# CHANGELOG
All breaking/notable changes to this project will be documented in the master.md file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://www.azerothcore.org/wiki/project-versioning).
To create a new changelog please follow the instructions on our [wiki page](https://www.azerothcore.org/wiki/how-to-use-changelog)

1
doc/changelog/master.md Normal file
View File

@ -0,0 +1 @@

View File

@ -0,0 +1,6 @@
### Added
- Created new changelog system.
### How to upgrade
To create a new changelog please follow the instructions on our [wiki page](https://www.azerothcore.org/wiki/how-to-use-changelog)

View File

@ -0,0 +1,21 @@
#!/usr/bin/env bash
unamestr=$(uname)
echo "OS: $unamestr"
if [[ "$unamestr" == 'Darwin' ]]; then
rev=$(gdate +%s%N );
else
rev=$(date +%s%N );
fi
CUR_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )/" && pwd )";
filename=changes_"$rev".md
echo "Insert your changelog here
### How to upgrade
Add instructions on how to adapt the code to the new changes
" > "$CUR_PATH/$filename" && echo "File created: $filename";

View File

@ -0,0 +1,51 @@
## We suggest using the latest master branch
This is old and may not be working.
We suggest that you always use the latest version of our master branch.
https://github.com/azerothcore/azerothcore-wotlk/tree/master
## Upgrade instructions
For server administrators: instructions about how to upgrade existing servers are available [here](http://www.azerothcore.org/wiki/Upgrade-from-pre-2.0.0-to-latest-master).
## Release notes
I'm pleased to release this new version of AzerothCore. This achievement was only possible thanks to all the contributors of our awesome community.
Special thanks to @talamortis @BarbzYHOOL @Deku @Stoabrogga @poszer @Viste @wetbrownsauce @CookieMonsterDev @Nefertumm @xDevICCI @pangolp @Winfidonarleyan @brussens @Yehonal
@comix1988 @Rochet2 @masterking32 @mik1893 @STARRHELD @a4501150 @Trystanosaurus @FALL1N1 @Kaev @Ayasecore @Pondaveia @Gargarensis and all the other [developers](https://github.com/azerothcore/azerothcore-wotlk/graphs/contributors), testers, supporters and custom modules/tools developers!
The full list of improvements was just too big to be published here, so I will only add some of the improvements that have been implemented since release 1.x:
- Solved all DB installation issues
- Implemented AC Docker setup
- Fixed all DB startup errors
- Eluna is now supported (special thanks @AyaseCore )
- Travis now prevents startup DB errors to get on master
- Fixed all compilation warnings
- Align most of the DB tables structure with TC
- Align SmartAI enums with TC
- Align conditions enums with TC
- Misc improvements to the SmartAI system
- The core will now trigger error if unsupported SmartAI action/even/types are used
- Fixed MySQL 5.7 issues
- Fixed many Quests (the list is too big to report it here)
- Improved movement and positioning for vanity pets
- Fixed clang 7 build
- Fixed Val'anyr Hammer of Ancient Kings
- Fixed Amplify Damage
- Update waypoints for black knight in Trail of the champion to be more blizzlike
- Fixed Mage Empowered Fire Talent
- Warlock Life Tap
- Fixed Mirror Image
- Added a few custom commands
- Fixed Glyph Learning for dual talent
- Fixed Deathgrip
- Fixed Rogue Tier 1 proc
- Fixed Guild Charter
- Fixed heirlooms to apply stats before giving health.
- Fixed pet bar will now show after /reload command
- Fixed npc falling through textures
- Fixed Noth the Plaguebringer casting upon returning back to ground
...and many other improvements! You can check the full changelog [here](https://github.com/azerothcore/azerothcore-wotlk/commits/master).

File diff suppressed because it is too large Load Diff