Skip to content

Commit

Permalink
GitHub manual action for LEAF updates
Browse files Browse the repository at this point in the history
  • Loading branch information
jefferya committed Dec 14, 2024
1 parent 26186c5 commit b87e2f8
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 8 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/manual_leaf_update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Manual LEAF Updater Workflow

on:
workflow_dispatch:

jobs:
auto-update:
runs-on: ubuntu-latest

steps:

# https://github.com/actions/checkout
- name: Checkout repository
uses: actions/checkout@v4

# https://github.com/docker/setup-qemu-action
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

# Set up BuildKit Docker container builder to be able to build
# multi-platform images and export cache
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0

# Build new branch with LEAF updates
- name: Run auto update
run: |
bash ./docker/drupal/scripts/auto.sh
22 changes: 14 additions & 8 deletions docker/drupal/scripts/auto.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@

git switch main
git pull
BRANCH=$(git branch --show-current)
if [ "${BRANCH}" != 'main' ]; then
echo "Not on the main branch: ${BRANCH}"
# git switch main && git pull
exit 1
fi

LEAF_VERSION_LOCAL=$(jq -r '.variable.LEAF_VERSION.default' docker-bake-leaf-version-override.json)
echo ${LEAF_VERSION_LOCAL}
echo "LOCAL LEAF: ${LEAF_VERSION_LOCAL}"

# Get remote LEAF tag
LEAF_VERSION=$(
Expand All @@ -12,15 +17,16 @@ LEAF_VERSION=$(
sort -V | \
tail -n1
)
echo $LEAF_VERSION
echo "Remote LEAF: ${LEAF_VERSION}"

if [ "${LEAF_VERSION_LOCAL}" = "${LEAF_VERSION}" ]; then
echo "Version up-to-date ${LEAF_VERSION_LOCAL}"
exit
exit 2
else
git checkout -b "leaf_update_${LEAF_VERSION}"
update_leaf_version_test(${LEAF_VERSION})
git commit -a -m "Bump LEAF version from ${LEAF_VERSION_LOCAL} to ${LEAF_VERSION}" && git push
echo "Version update from ${LEAF_VERSION_LOCAL} to ${LEAF_VERSION}"
#git checkout -b "leaf_update_${LEAF_VERSION}"
update_leaf_version_test ${LEAF_VERSION}
#git commit -a -m "Bump LEAF version from ${LEAF_VERSION_LOCAL} to ${LEAF_VERSION}" && git push
fi

function update_leaf_version_test() {
Expand Down

0 comments on commit b87e2f8

Please sign in to comment.