Skip to content

Commit fa7277d

Browse files
Merge branch 'master' into moo-1800/update-dependencies
2 parents 3765f03 + 486bc2f commit fa7277d

8 files changed

Lines changed: 480 additions & 3 deletions

File tree

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: 'Slack Notification'
2+
description: 'Send notification to Slack channel'
3+
4+
inputs:
5+
channel-id:
6+
description: 'Slack channel ID'
7+
required: true
8+
message:
9+
description: 'Message to send'
10+
required: true
11+
bot-token:
12+
description: 'Slack bot token'
13+
required: true
14+
15+
runs:
16+
using: "composite"
17+
steps:
18+
- name: Send Slack notification
19+
uses: slackapi/slack-github-action@485a9d42d3a73031f12ec201c457e2162c45d02d # v2
20+
with:
21+
channel-id: ${{ inputs.channel-id }}
22+
slack-message: ${{ inputs.message }}
23+
env:
24+
SLACK_BOT_TOKEN: ${{ inputs.bot-token }}

.github/workflows/update_releases_list.yml

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,48 @@ jobs:
1212
steps:
1313
- uses: actions/checkout@v2
1414

15+
- name: Setup Node.js
16+
uses: actions/setup-node@v2
17+
with:
18+
node-version: "16"
19+
1520
- name: Fetch & Generate Releases List
1621
uses: actions/github-script@v3
1722
with:
1823
script: |
1924
const script = require(`${process.env.GITHUB_WORKSPACE}/.github/update_releases_list.js`);
2025
await script({github});
2126
27+
- name: Update Version Compatibility
28+
run: |
29+
cd docs/version-compatibility
30+
node -e "require('./update-versions.js').updateVersionsJson()"
31+
2232
- name: Create Pull Request
33+
id: pr
2334
uses: peter-evans/create-pull-request@v3
2435
with:
25-
commit-message: '[BUILD] Update Release List'
36+
commit-message: "[BUILD] Update Release List and Version Compatibility"
2637
committer: github-action <41898282+github-actions[bot]@users.noreply.github.com>
2738
author: github-action <41898282+github-actions[bot]@users.noreply.github.com>
2839
delete-branch: true
29-
title: '[BUILD] Update Release List'
30-
body: ''
40+
title: "[BUILD] Update Release List and Version Compatibility"
41+
body: |
42+
This PR updates:
43+
- Release list
44+
- Version compatibility information
3145
branch: update-releases-list
3246
branch-suffix: short-commit-hash
47+
48+
- name: Send Slack Notification
49+
if: success()
50+
uses: ./.github/actions/slack-notification
51+
with:
52+
channel-id: ${{ secrets.SLACK_CHANNEL_ID }}
53+
bot-token: ${{ secrets.SLACK_BOT_TOKEN }}
54+
message: |
55+
🚀 *New Native Template Version Released*
56+
57+
A new version of Native Template has been released with updated version compatibility information.
58+
59+
Please review the PR for more details: ${{ github.server_url }}/${{ github.repository }}/pull/${{ steps.pr.outputs.number }}
22.9 KB
Loading
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
">=10.21.0": {
3+
"max": "*",
4+
"min": "13.0.0",
5+
"androidSdk": {
6+
"min": "23",
7+
"compile": "35",
8+
"target": "35"
9+
},
10+
"gradle": "7.4.0",
11+
"iosMinSdk": "13.4"
12+
},
13+
">=10.19.0": {
14+
"max": "12.*.*",
15+
"min": "12.0.0",
16+
"androidSdk": {
17+
"min": "23",
18+
"compile": "35",
19+
"target": "35"
20+
},
21+
"gradle": "7.4.0",
22+
"iosMinSdk": "13.4"
23+
},
24+
">=10.18.0": {
25+
"max": "11.*.*",
26+
"min": "11.0.0",
27+
"androidSdk": {
28+
"min": "23",
29+
"compile": "35",
30+
"target": "35"
31+
},
32+
"gradle": "7.4.0",
33+
"iosMinSdk": "13.4"
34+
},
35+
">=10.17.0": {
36+
"max": "10.*.*",
37+
"min": "10.0.0",
38+
"androidSdk": {
39+
"min": "23",
40+
"compile": "35",
41+
"target": "35"
42+
},
43+
"gradle": "7.4.0",
44+
"iosMinSdk": "13.4"
45+
}
46+
}
Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
const fs = require("fs");
2+
const path = require("path");
3+
4+
// Function to read Android SDK version from build.gradle
5+
function getAndroidSdkVersion() {
6+
try {
7+
const gradlePath = path.join(__dirname, "../../android/build.gradle");
8+
const gradleContent = fs.readFileSync(gradlePath, "utf8");
9+
10+
// Extract all SDK versions from ext block
11+
const minSdkMatch = gradleContent.match(/minSdkVersion\s*=\s*(\d+)/);
12+
const compileSdkMatch = gradleContent.match(
13+
/compileSdkVersion\s*=\s*(\d+)/
14+
);
15+
const targetSdkMatch = gradleContent.match(/targetSdkVersion\s*=\s*(\d+)/);
16+
17+
const versions = {
18+
minSdk: minSdkMatch ? minSdkMatch[1] : null,
19+
compileSdk: compileSdkMatch ? compileSdkMatch[1] : null,
20+
targetSdk: targetSdkMatch ? targetSdkMatch[1] : null,
21+
};
22+
23+
if (minSdkMatch) console.log(`Found minSdkVersion: ${minSdkMatch[1]}`);
24+
if (compileSdkMatch)
25+
console.log(`Found compileSdkVersion: ${compileSdkMatch[1]}`);
26+
if (targetSdkMatch)
27+
console.log(`Found targetSdkVersion: ${targetSdkMatch[1]}`);
28+
29+
return versions;
30+
} catch (error) {
31+
console.error("Error reading Android SDK version:", error);
32+
return null;
33+
}
34+
}
35+
36+
// Function to read Gradle version from build.gradle
37+
function getGradleVersion() {
38+
try {
39+
const gradlePath = path.join(__dirname, "../../android/build.gradle");
40+
const gradleContent = fs.readFileSync(gradlePath, "utf8");
41+
42+
// Extract Gradle version
43+
const gradleMatch = gradleContent.match(
44+
/classpath\s+['"]com\.android\.tools\.build:gradle:([\d.]+)['"]/
45+
);
46+
if (gradleMatch) {
47+
console.log(`Found Gradle version: ${gradleMatch[1]}`);
48+
return gradleMatch[1];
49+
}
50+
51+
console.log("Could not find Gradle version in build.gradle");
52+
return null;
53+
} catch (error) {
54+
console.error("Error reading Gradle version:", error);
55+
return null;
56+
}
57+
}
58+
59+
// Function to read iOS minimum SDK version from Podfile
60+
function getIosMinSdkVersion() {
61+
try {
62+
const podfilePath = path.join(__dirname, "../../ios/Podfile");
63+
const podfileContent = fs.readFileSync(podfilePath, "utf8");
64+
65+
// Extract deployment_target value
66+
const deploymentTargetMatch = podfileContent.match(
67+
/deployment_target\s*=\s*['"]([\d.]+)['"]/
68+
);
69+
if (deploymentTargetMatch) {
70+
console.log(`Found iOS deployment target: ${deploymentTargetMatch[1]}`);
71+
return deploymentTargetMatch[1];
72+
}
73+
74+
console.log("Could not find iOS deployment target in Podfile");
75+
return null;
76+
} catch (error) {
77+
console.error("Error reading iOS SDK version:", error);
78+
return null;
79+
}
80+
}
81+
82+
// Function to update versions.json with new SDK versions
83+
function updateVersionsJson() {
84+
try {
85+
// Read mendix_version.json to get the latest version
86+
const mendixVersionsPath = path.join(
87+
__dirname,
88+
"../../mendix_version.json"
89+
);
90+
const mendixVersionsContent = fs.readFileSync(mendixVersionsPath, "utf8");
91+
const mendixVersions = JSON.parse(mendixVersionsContent);
92+
93+
// Get the latest version (first key in the object)
94+
const latestMendixVersion = Object.keys(mendixVersions)[0];
95+
const latestNativeTemplateVersion = mendixVersions[latestMendixVersion].min;
96+
97+
// Read current native_template_versions.json
98+
const nativeTemplateVersionsPath = path.join(
99+
__dirname,
100+
"native_template_versions.json"
101+
);
102+
const nativeTemplateVersionsContent = fs.readFileSync(
103+
nativeTemplateVersionsPath,
104+
"utf8"
105+
);
106+
const nativeTemplateVersions = JSON.parse(nativeTemplateVersionsContent);
107+
108+
// Get current SDK versions
109+
const androidSdk = getAndroidSdkVersion();
110+
const gradle = getGradleVersion();
111+
const iosMinSdk = getIosMinSdkVersion();
112+
113+
// Check if the version already exists in native_template_versions.json
114+
if (!nativeTemplateVersions[latestMendixVersion]) {
115+
// Create new object with the latest version at the top
116+
const updatedVersions = {
117+
[latestMendixVersion]: {
118+
max: mendixVersions[latestMendixVersion].max,
119+
min: latestNativeTemplateVersion,
120+
androidSdk: {
121+
min: androidSdk?.minSdk || null,
122+
compile: androidSdk?.compileSdk || null,
123+
target: androidSdk?.targetSdk || null,
124+
},
125+
gradle: gradle,
126+
iosMinSdk: iosMinSdk,
127+
},
128+
...nativeTemplateVersions,
129+
};
130+
131+
// Write updated versions back to file
132+
fs.writeFileSync(
133+
nativeTemplateVersionsPath,
134+
JSON.stringify(updatedVersions, null, 4)
135+
);
136+
} else {
137+
console.log(
138+
`Version ${latestMendixVersion} already exists in native_template_versions.json`
139+
);
140+
}
141+
} catch (error) {
142+
console.error("Error updating versions:", error);
143+
}
144+
}
145+
146+
// Export functions for use in other scripts
147+
module.exports = {
148+
getAndroidSdkVersion,
149+
getGradleVersion,
150+
getIosMinSdkVersion,
151+
updateVersionsJson,
152+
};

0 commit comments

Comments
 (0)