Skip to content

Commit

Permalink
Merge branch 'master' into release/T24.drac
Browse files Browse the repository at this point in the history
  • Loading branch information
Camwyn committed Sep 11, 2024
2 parents 7b34f28 + 505a728 commit b9fccc9
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 6 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@ on:
- 'src/modules/**.js'
- 'src/resources/js/**.js'
- 'src/resources/postcss/**.pcss'
- '.github/**/*'
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v4
uses: actions/checkout@v2
with:
fetch-depth: 1
submodules: recursive
Expand Down
35 changes: 31 additions & 4 deletions bin/process-changelog.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,34 @@ CURRENT_VERSION=${2-}
ACTION_TYPE=${3-generate}
RELEASE_DATE=${4-today}

RELEASE_DATE=$( date "+%Y-%m-%d" -d "$RELEASE_DATE" ) # Release date formatted as YYYY-MM-DD
if [[ "$OSTYPE" == "darwin"* ]]; then
# macOS with gdate
RELEASE_DATE=$( gdate "+%Y-%m-%d" -d "$RELEASE_DATE" )
else
# Linux
RELEASE_DATE=$( date "+%Y-%m-%d" -d "$RELEASE_DATE" )
fi

sed_compatible() {
if [[ "$1" == "-r" ]]; then
# Remove the -r argument
shift
if [[ "$OSTYPE" == "darwin"* ]]; then
# macOS with -E flag
sed -i '' -E "$@"
else
# Linux with -r flag
sed -i -r "$@"
fi
else
# No -r argument, regular sed command
if [[ "$OSTYPE" == "darwin"* ]]; then
sed -i '' "$@"
else
sed -i "$@"
fi
fi
}

SCRIPT_DIR="$(dirname "$(readlink -f "$0")")"

Expand All @@ -14,7 +41,7 @@ cd $SCRIPT_DIR/../
echo "RELEASE_DATE=$RELEASE_DATE"

if [ "$ACTION_TYPE" == "amend-version" ]; then
perl -i -pe "s/^### \[\Q$CURRENT_VERSION\E\] .*$/### [$RELEASE_VERSION] $RELEASE_DATE/" changelog.md
sed_compatible "s/^### \[$CURRENT_VERSION\] .*$/### [$RELEASE_VERSION] $RELEASE_DATE/" changelog.md
else
if [ "$ACTION_TYPE" == "generate" ]; then
CHANGELOG_FLAG=""
Expand All @@ -38,11 +65,11 @@ CHANGELOG=${CHANGELOG//&/\\&}
echo "CHANGELOG=$CHANGELOG"

if [ "$ACTION_TYPE" == "amend-version" ]; then
perl -i -pe "s/^= \[\Q$CURRENT_VERSION\E\] .* =$/= [$RELEASE_VERSION] $RELEASE_DATE =/" readme.txt
sed_compatible "s/^= \[$CURRENT_VERSION\] .* =$/= [$RELEASE_VERSION] $RELEASE_DATE =/" readme.txt
else
if [ "$ACTION_TYPE" == "amend" ]; then
perl -i -p0e "s/= \[$RELEASE_VERSION\].*? =(.*?)(\n){2}(?==)//s" readme.txt # Delete the existing changelog for the release version first
fi

perl -i -pe "s/(== Changelog ==)/\1\n\n= [$RELEASE_VERSION] $RELEASE_DATE =\n\n$CHANGELOG/" readme.txt
sed_compatible -r "s|(== Changelog ==)|\1\n\n= [$RELEASE_VERSION] $RELEASE_DATE =\n\n$CHANGELOG|" readme.txt
fi

0 comments on commit b9fccc9

Please sign in to comment.