-
Notifications
You must be signed in to change notification settings - Fork 0
134 lines (116 loc) · 4.44 KB
/
update-mendix-version.yml
File metadata and controls
134 lines (116 loc) · 4.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
name: Update Mendix Version
on:
schedule:
- cron: '0 8 * * 1' # Every Monday at 08:00 UTC
workflow_dispatch: # Manual trigger
permissions:
contents: write
jobs:
check-mendix-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Read current Mendix version
id: current
run: echo "version=$(cat .mendix-version)" >> "$GITHUB_OUTPUT"
- name: Check for newer Mendix versions
id: check
run: |
CURRENT="${{ steps.current.outputs.version }}"
MAJOR=$(echo "$CURRENT" | cut -d. -f1)
MINOR=$(echo "$CURRENT" | cut -d. -f2)
PATCH=$(echo "$CURRENT" | cut -d. -f3)
LATEST="$CURRENT"
# Check patch versions (e.g., 11.6.3 -> 11.6.4, 11.6.5, ...)
for i in $(seq 1 20); do
CANDIDATE="$MAJOR.$MINOR.$((PATCH + i))"
STATUS=$(curl -s -o /dev/null -w "%{http_code}" \
"https://cdn.mendix.com/runtime/mxbuild-${CANDIDATE}.tar.gz")
if [ "$STATUS" = "200" ]; then
LATEST="$CANDIDATE"
else
break
fi
done
# Check next minor version (e.g., 11.6.x -> 11.7.0)
CANDIDATE="$MAJOR.$((MINOR + 1)).0"
STATUS=$(curl -s -o /dev/null -w "%{http_code}" \
"https://cdn.mendix.com/runtime/mxbuild-${CANDIDATE}.tar.gz")
if [ "$STATUS" = "200" ]; then
NEW_MINOR=$((MINOR + 1))
LATEST="$CANDIDATE"
for i in $(seq 1 20); do
CANDIDATE="$MAJOR.$NEW_MINOR.$i"
STATUS=$(curl -s -o /dev/null -w "%{http_code}" \
"https://cdn.mendix.com/runtime/mxbuild-${CANDIDATE}.tar.gz")
if [ "$STATUS" = "200" ]; then
LATEST="$CANDIDATE"
else
break
fi
done
fi
if [ "$LATEST" = "$CURRENT" ]; then
echo "No new Mendix version found (current: $CURRENT)"
echo "found=false" >> "$GITHUB_OUTPUT"
else
echo "New Mendix version found: $LATEST (was: $CURRENT)"
echo "found=true" >> "$GITHUB_OUTPUT"
echo "version=$LATEST" >> "$GITHUB_OUTPUT"
fi
- name: Install JDK 21
if: steps.check.outputs.found == 'true'
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
- name: Download mxbuild
if: steps.check.outputs.found == 'true'
run: |
VERSION="${{ steps.check.outputs.version }}"
curl -fsSL "https://cdn.mendix.com/runtime/mxbuild-${VERSION}.tar.gz" \
-o mxbuild.tar.gz
mkdir -p mxbuild
tar xzf mxbuild.tar.gz -C mxbuild
- name: Create fresh Mendix project
if: steps.check.outputs.found == 'true'
run: |
# Remove old project files
rm -rf App.mpr mprcontents/
# Create new blank project
cd ${{ github.workspace }}
./mxbuild/modeler/mx create-project
# Update version pin
echo "${{ steps.check.outputs.version }}" > .mendix-version
- name: Download mxcli and re-initialize
if: steps.check.outputs.found == 'true'
run: |
MXCLI_VERSION=$(cat .mxcli-version)
curl -fsSL "https://github.com/mendixlabs/mxcli/releases/download/${MXCLI_VERSION}/mxcli-linux-amd64" \
-o /usr/local/bin/mxcli
chmod +x /usr/local/bin/mxcli
# Re-initialize (updates devcontainer to reference new Mendix version)
mxcli init -p App.mpr --all-tools --force
- name: Validate seed scripts
if: steps.check.outputs.found == 'true'
run: |
FAILED=0
for f in scripts/*.mdl; do
echo "Checking $f..."
if ! mxcli check "$f" 2>&1; then
echo "WARNING: $f failed syntax check"
FAILED=1
fi
done
if [ "$FAILED" = "1" ]; then
echo "::warning::Some seed scripts failed validation after Mendix version update"
fi
- name: Commit and push
if: steps.check.outputs.found == 'true'
run: |
VERSION="${{ steps.check.outputs.version }}"
git config user.name "mxcli-bot"
git config user.email "mxcli-bot@mendix.com"
git add -A
git commit -m "chore: update Mendix project to $VERSION"
git push origin main