Skip to content

Commit

Permalink
Add auto updates for drupal-cms
Browse files Browse the repository at this point in the history
  • Loading branch information
csandanov committed Jan 24, 2025
1 parent 4fc3f97 commit c3c4247
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
script: [drupal-php,wordpress-php,adminer-php,matomo-php,webgrind-php,laravel-php,drupal,wordpress,xhprof]
script: [drupal-php,wordpress-php,adminer-php,matomo-php,webgrind-php,laravel-php,drupal,wordpress,xhprof,drupal-cms]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions
Expand All @@ -65,7 +65,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
script: [adminer,cachet,drupal,elasticsearch,kibana,mariadb,matomo,nginx,varnish,webgrind,wordpress,xhprof,]
script: [adminer,cachet,drupal,elasticsearch,kibana,mariadb,matomo,nginx,varnish,webgrind,wordpress,xhprof,drupal-cms]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
| [wodby/adminer] | [wodby/php] | `8.1` | |
| [wodby/drupal-php] | [wodby/php] | `8.4`, `8.3`, `8.2`, `8.1` | `4.x` |
| [wodby/drupal] | [wodby/drupal-php] | `8.4`, `8.3`, `8.2`, `8.1` | `4.x` |
| [wodby/drupal-cms] | [wodby/drupal-php] | `8.3` | |
| [wodby/matomo] | [wodby/php] | `8.1` | |
| [wodby/webgrind] | [wodby/php] | `8.1` | |
| [wodby/wordpress-php] | [wodby/php] | `8.4`, `8.3`, `8.2`, `8.1` | `4.x` |
Expand All @@ -62,6 +63,7 @@
| [wodby/adminer] | [vrana/adminer] | `4` | |
| [wodby/cachet] | [CachetHQ/Cachet] | `2` | |
| [wodby/drupal] | [drupal] | `11`, `10`, `7` | `4.x` |
| [wodby/drupal-cms] | [drupal-cms] | `1` | |
| [wodby/elasticsearch] | [elastic/elasticsearch] | `7` | |
| [wodby/kibana] | [elastic/kibana] | `7` | |
| [wodby/mariadb] | [mariadb] | `11.4`, `11.2`, `10.11`, `10.6`, `10.5` | |
Expand Down Expand Up @@ -101,6 +103,8 @@ Not automated:

[drupal]: https://github.com/drupal/drupal

[drupal-cms]: https://git.drupalcode.org/project/cms

[elastic/elasticsearch]: https://github.com/elastic/elasticsearch

[elastic/kibana]: https://github.com/elastic/kibana
Expand Down Expand Up @@ -171,6 +175,8 @@ Not automated:

[wodby/drupal]: https://github.com/wodby/drupal

[wodby/drupal-cms]: https://github.com/wodby/drupal-cms

[wodby/elasticsearch]: https://github.com/wodby/elasticsearch

[_/httpd]: https://hub.docker.com/_/httpd
Expand Down
7 changes: 7 additions & 0 deletions stability-tags/drupal-cms.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash

set -e

. ../update.sh

rebuild_and_rebase "wodby/drupal-cms" "8.3"
41 changes: 41 additions & 0 deletions update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,21 @@ fi
git config --global user.email "${GIT_USER_EMAIL}"
git config --global user.name "${GIT_USER_NAME}"

urlencode() {
local length="${#1}"
local encoded=""
for (( i = 0; i < length; i++ )); do
local c="${1:i:1}"
case "$c" in
[a-zA-Z0-9.~_-]) encoded+="$c" ;;
*) printf -v hex '%%%02X' "'$c"
encoded+="$hex"
;;
esac
done
echo "$encoded"
}

_git_commit() {
local dir="${1}"
local msg="${2}"
Expand Down Expand Up @@ -127,6 +142,30 @@ _github_get_latest_ver() {
fi
}

_gitlab_get_latest_ver() {
local version="${1}"
local url="${2}"

local host="${url%%/*}"
local encoded_path=$(urlencode "${url#*/}")

local api_url="https://$host/api/v4/projects/$encoded_path/repository/tags"

local expr=".[] | select ( .name | startswith(\"${version}\")).name"

local -a versions

# Only stable versions.
versions=($(curl -s "${url}" | jq -r "${expr}" | grep -oP "^[0-9\.]+$" | sort -rV))

if [[ "${#versions}" == 0 ]]; then
echo >&2 "Couldn't find latest version in line ${version} of ${slug}."
exit 1
else
echo "${versions[0]}"
fi
}

_get_latest_version() {
local upstream="${1%:*}"
local version="${2}"
Expand All @@ -136,6 +175,8 @@ _get_latest_version() {
# Get latest stable version from github.
if [[ "${upstream}" == "github.com"* ]]; then
latest_ver=$(_github_get_latest_ver "${version}" "${upstream/github.com\//}" "${name}")
elif [[ "${upstream}" == "git.drupalcode.org"* ]]; then
latest_ver=$(_gitlab_get_latest_ver "${version}" "${upstream}")
# From docker hub, only patch updates.
else
local makefilePath
Expand Down
7 changes: 7 additions & 0 deletions upstream/drupal-cms.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash

set -e

. ../update.sh

update_from_upstream "wodby/drupal-cms" "1" "git.drupalcode.org/project/cms"

0 comments on commit c3c4247

Please sign in to comment.