Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .github/actions/slack-notification/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: 'Slack Notification'
description: 'Send notification to Slack channel'

inputs:
channel-id:
description: 'Slack channel ID'
required: true
message:
description: 'Message to send'
required: true
bot-token:
description: 'Slack bot token'
required: true

runs:
using: "composite"
steps:
- name: Send Slack notification
uses: slackapi/slack-github-action@485a9d42d3a73031f12ec201c457e2162c45d02d # v2
with:
channel-id: ${{ inputs.channel-id }}
slack-message: ${{ inputs.message }}
env:
SLACK_BOT_TOKEN: ${{ inputs.bot-token }}
33 changes: 30 additions & 3 deletions .github/workflows/update_releases_list.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,48 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: "16"

- name: Fetch & Generate Releases List
uses: actions/github-script@v3
with:
script: |
const script = require(`${process.env.GITHUB_WORKSPACE}/.github/update_releases_list.js`);
await script({github});

- name: Update Version Compatibility
run: |
cd docs/version-compatibility
node -e "require('./update-versions.js').updateVersionsJson()"

- name: Create Pull Request
id: pr
uses: peter-evans/create-pull-request@v3
with:
commit-message: '[BUILD] Update Release List'
commit-message: "[BUILD] Update Release List and Version Compatibility"
committer: github-action <41898282+github-actions[bot]@users.noreply.github.com>
author: github-action <41898282+github-actions[bot]@users.noreply.github.com>
delete-branch: true
title: '[BUILD] Update Release List'
body: ''
title: "[BUILD] Update Release List and Version Compatibility"
body: |
This PR updates:
- Release list
- Version compatibility information
branch: update-releases-list
branch-suffix: short-commit-hash

- name: Send Slack Notification
if: success()
uses: ./.github/actions/slack-notification
with:
channel-id: ${{ secrets.SLACK_CHANNEL_ID }}
bot-token: ${{ secrets.SLACK_BOT_TOKEN }}
message: |
🚀 *New Native Template Version Released*

A new version of Native Template has been released with updated version compatibility information.

Please review the PR for more details: ${{ github.server_url }}/${{ github.repository }}/pull/${{ steps.pr.outputs.number }}
Binary file added docs/version-compatibility/assets/Mendix_Logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
46 changes: 46 additions & 0 deletions docs/version-compatibility/native_template_versions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
">=10.21.0": {
"max": "*",
"min": "13.0.0",
"androidSdk": {
"min": "23",
"compile": "35",
"target": "35"
},
"gradle": "7.4.0",
"iosMinSdk": "13.4"
},
">=10.19.0": {
"max": "12.*.*",
"min": "12.0.0",
"androidSdk": {
"min": "23",
"compile": "35",
"target": "35"
},
"gradle": "7.4.0",
"iosMinSdk": "13.4"
},
">=10.18.0": {
"max": "11.*.*",
"min": "11.0.0",
"androidSdk": {
"min": "23",
"compile": "35",
"target": "35"
},
"gradle": "7.4.0",
"iosMinSdk": "13.4"
},
">=10.17.0": {
"max": "10.*.*",
"min": "10.0.0",
"androidSdk": {
"min": "23",
"compile": "35",
"target": "35"
},
"gradle": "7.4.0",
"iosMinSdk": "13.4"
}
}
152 changes: 152 additions & 0 deletions docs/version-compatibility/update-versions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
const fs = require("fs");
const path = require("path");

// Function to read Android SDK version from build.gradle
function getAndroidSdkVersion() {
try {
const gradlePath = path.join(__dirname, "../../android/build.gradle");
const gradleContent = fs.readFileSync(gradlePath, "utf8");

// Extract all SDK versions from ext block
const minSdkMatch = gradleContent.match(/minSdkVersion\s*=\s*(\d+)/);
const compileSdkMatch = gradleContent.match(
/compileSdkVersion\s*=\s*(\d+)/
);
const targetSdkMatch = gradleContent.match(/targetSdkVersion\s*=\s*(\d+)/);

const versions = {
minSdk: minSdkMatch ? minSdkMatch[1] : null,
compileSdk: compileSdkMatch ? compileSdkMatch[1] : null,
targetSdk: targetSdkMatch ? targetSdkMatch[1] : null,
};

if (minSdkMatch) console.log(`Found minSdkVersion: ${minSdkMatch[1]}`);
if (compileSdkMatch)
console.log(`Found compileSdkVersion: ${compileSdkMatch[1]}`);
if (targetSdkMatch)
console.log(`Found targetSdkVersion: ${targetSdkMatch[1]}`);

return versions;
} catch (error) {
console.error("Error reading Android SDK version:", error);
return null;
}
}

// Function to read Gradle version from build.gradle
function getGradleVersion() {
try {
const gradlePath = path.join(__dirname, "../../android/build.gradle");
const gradleContent = fs.readFileSync(gradlePath, "utf8");

// Extract Gradle version
const gradleMatch = gradleContent.match(
/classpath\s+['"]com\.android\.tools\.build:gradle:([\d.]+)['"]/
);
if (gradleMatch) {
console.log(`Found Gradle version: ${gradleMatch[1]}`);
return gradleMatch[1];
}

console.log("Could not find Gradle version in build.gradle");
return null;
} catch (error) {
console.error("Error reading Gradle version:", error);
return null;
}
}

// Function to read iOS minimum SDK version from Podfile
function getIosMinSdkVersion() {
try {
const podfilePath = path.join(__dirname, "../../ios/Podfile");
const podfileContent = fs.readFileSync(podfilePath, "utf8");

// Extract deployment_target value
const deploymentTargetMatch = podfileContent.match(
/deployment_target\s*=\s*['"]([\d.]+)['"]/
);
if (deploymentTargetMatch) {
console.log(`Found iOS deployment target: ${deploymentTargetMatch[1]}`);
return deploymentTargetMatch[1];
}

console.log("Could not find iOS deployment target in Podfile");
return null;
} catch (error) {
console.error("Error reading iOS SDK version:", error);
return null;
}
}

// Function to update versions.json with new SDK versions
function updateVersionsJson() {
try {
// Read mendix_version.json to get the latest version
const mendixVersionsPath = path.join(
__dirname,
"../../mendix_version.json"
);
const mendixVersionsContent = fs.readFileSync(mendixVersionsPath, "utf8");
const mendixVersions = JSON.parse(mendixVersionsContent);

// Get the latest version (first key in the object)
const latestMendixVersion = Object.keys(mendixVersions)[0];
const latestNativeTemplateVersion = mendixVersions[latestMendixVersion].min;

// Read current native_template_versions.json
const nativeTemplateVersionsPath = path.join(
__dirname,
"native_template_versions.json"
);
const nativeTemplateVersionsContent = fs.readFileSync(
nativeTemplateVersionsPath,
"utf8"
);
const nativeTemplateVersions = JSON.parse(nativeTemplateVersionsContent);

// Get current SDK versions
const androidSdk = getAndroidSdkVersion();
const gradle = getGradleVersion();
const iosMinSdk = getIosMinSdkVersion();

// Check if the version already exists in native_template_versions.json
if (!nativeTemplateVersions[latestMendixVersion]) {
// Create new object with the latest version at the top
const updatedVersions = {
[latestMendixVersion]: {
max: mendixVersions[latestMendixVersion].max,
min: latestNativeTemplateVersion,
androidSdk: {
min: androidSdk?.minSdk || null,
compile: androidSdk?.compileSdk || null,
target: androidSdk?.targetSdk || null,
},
gradle: gradle,
iosMinSdk: iosMinSdk,
},
...nativeTemplateVersions,
};

// Write updated versions back to file
fs.writeFileSync(
nativeTemplateVersionsPath,
JSON.stringify(updatedVersions, null, 4)
);
} else {
console.log(
`Version ${latestMendixVersion} already exists in native_template_versions.json`
);
}
} catch (error) {
console.error("Error updating versions:", error);
}
}

// Export functions for use in other scripts
module.exports = {
getAndroidSdkVersion,
getGradleVersion,
getIosMinSdkVersion,
updateVersionsJson,
};
Loading