diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 6c966242f5..83d3f42aec 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -3,7 +3,6 @@ on: pull_request: workflow_dispatch: paths: - - '.github/**/*' - 'src/modules/**.js' - 'src/resources/js/**.js' - 'src/resources/postcss/**.pcss' @@ -12,7 +11,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout the repository - uses: actions/checkout@v4 + uses: actions/checkout@v2 with: fetch-depth: 1 submodules: recursive diff --git a/bin/process-changelog.sh b/bin/process-changelog.sh index e2e93f1ef8..694774b3a2 100755 --- a/bin/process-changelog.sh +++ b/bin/process-changelog.sh @@ -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")")" @@ -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="" @@ -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