-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2268 from zowe/next
Move the `next` branch into `master`
- Loading branch information
Showing
1,107 changed files
with
23,177 additions
and
57,414 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
|
||
const mdFilePath = path.join(__dirname, '../RELEASE_HISTORY.md'); | ||
|
||
// Build the new row to be added | ||
const newRow = `| v${process.env.NEW_VERSION} | ${new Date().toISOString().split('T')[0].slice(0, 7)} | **Active** | [Release Notes](https://docs.zowe.org/stable/whats-new/release-notes/v${process.env.NEW_VERSION.replace(/\./g, '_')}) |`; | ||
|
||
// Read, Update and Write to Markdown File | ||
function updateReleaseHistory(newRow) { | ||
fs.readFile(mdFilePath, 'utf8', (err, data) => { | ||
if (err) { | ||
console.error('Error reading the file:', err); | ||
return; | ||
} | ||
|
||
// Find the table and insert the new row after the second row | ||
const lines = data.split('\n'); | ||
let tableLineCount = 0; | ||
for (let i = 0; i < lines.length; i++) { | ||
if (lines[i].startsWith('|') && lines[i].endsWith('|')) { | ||
tableLineCount++; | ||
if (tableLineCount === 2) { | ||
// Insert the new row after the second row | ||
lines.splice(i + 1, 0, newRow); | ||
break; | ||
} | ||
} | ||
} | ||
|
||
fs.writeFile(mdFilePath, lines.join('\n'), 'utf8', (err) => { | ||
if (err) { | ||
console.error('Error writing the file:', err); | ||
return; | ||
} | ||
console.log('Markdown file updated successfully.'); | ||
}); | ||
}); | ||
} | ||
|
||
// Update the zoweVersion in package.json | ||
function updatePackageJsonVersion(newVersion) { | ||
const packageJsonPath = path.join(__dirname, '../packages/cli/package.json'); | ||
fs.readFile(packageJsonPath, 'utf8', (err, data) => { | ||
if (err) { | ||
console.error('Error reading package.json:', err); | ||
return; | ||
} | ||
|
||
let packageJson = JSON.parse(data); | ||
packageJson.zoweVersion = `v${newVersion}`; | ||
|
||
fs.writeFile(packageJsonPath, JSON.stringify(packageJson, null, 2), 'utf8', (err) => { | ||
if (err) { | ||
console.error('Error writing to package.json:', err); | ||
return; | ||
} | ||
console.log('package.json updated successfully.'); | ||
}); | ||
}); | ||
} | ||
|
||
// Execute the functions | ||
updatePackageJsonVersion(process.env.NEW_VERSION); | ||
updateReleaseHistory(newRow); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
const https = require('https'); | ||
|
||
// This script is attempting to add whatever list of the CLI team is shown in the TSC repo https://raw.githubusercontent.com/zowe/community/master/COMMITTERS.md. | ||
// Despite efforts, this is not working. Adam will always be cut off (possibly just whoever is first in the table). | ||
// Leaving this code present and hoping that the problem with this file can be solved in the future. | ||
|
||
// URL of the raw markdown file to be appended to RELEASE_HISTORY.md | ||
const url = 'https://raw.githubusercontent.com/zowe/community/master/COMMITTERS.md'; | ||
|
||
// Build the new row to be added | ||
const newVersion = process.env.NEW_VERSION; | ||
const newRow = `| v${newVersion} | ${new Date().toISOString().split('T')[0].slice(0, 7)} | **Active** | [Release Notes](https://docs.zowe.org/stable/whats-new/release-notes/v${newVersion.replace(/\./g, '_')}) |`; | ||
|
||
const mdFilePath = path.join(__dirname, '../RELEASE_HISTORY.md'); | ||
|
||
// Function to fetch CLI team from a URL | ||
function fetchCliTeam(url) { | ||
return new Promise((resolve, reject) => { | ||
https.get(url, (res) => { | ||
let data = ''; | ||
|
||
// A chunk of data has been received | ||
res.on('data', (chunk) => { | ||
data += chunk; | ||
}); | ||
|
||
// The whole response has been received | ||
res.on('end', () => { | ||
// Extract only the CLI contributors section | ||
const cliSectionMatch = data.match(/### Zowe CLI Squad[\s\S]*?(?=###|$)/); | ||
const cliSection = cliSectionMatch ? cliSectionMatch[0] : ''; | ||
resolve(cliSection); | ||
}); | ||
}).on('error', (err) => { | ||
reject(err); | ||
}); | ||
}); | ||
} | ||
|
||
// Function to remove existing CLI team section and append new one | ||
function updateCliTeamInMd(cliTeam) { | ||
// Read the current content of the markdown file | ||
fs.readFile(mdFilePath, 'utf8', (err, data) => { | ||
if (err) { | ||
console.error('Error reading the file:', err); | ||
return; | ||
} | ||
|
||
// Remove the old CLI squad section and replace it with the new one | ||
const updatedData = data.replace(/### Zowe CLI Squad[\s\S]*?(?=###|$)/, cliTeam + '\n'); | ||
|
||
// Write the updated data back to the file | ||
fs.writeFile(mdFilePath, updatedData, 'utf8', (err) => { | ||
if (err) { | ||
console.error('Error writing the file:', err); | ||
return; | ||
} | ||
console.log('CLI team has been updated in RELEASE_HISTORY.md successfully.'); | ||
}); | ||
}); | ||
} | ||
|
||
// Main function to fetch CLI team and update RELEASE_HISTORY | ||
async function appendCliTeam() { | ||
try { | ||
const cliTeam = await fetchCliTeam(url); | ||
updateCliTeamInMd(cliTeam); | ||
} catch (error) { | ||
console.error('Error fetching CLI team:', error); | ||
} | ||
} | ||
|
||
// Read, Update and Write to Markdown File | ||
function updateReleaseHistory(newRow) { | ||
fs.readFile(mdFilePath, 'utf8', (err, data) => { | ||
if (err) { | ||
console.error('Error reading the file:', err); | ||
return; | ||
} | ||
|
||
// Find the table and insert the new row after the second row | ||
const lines = data.split('\n'); | ||
let tableLineCount = 0; | ||
for (let i = 0; i < lines.length; i++) { | ||
if (lines[i].startsWith('|') && lines[i].endsWith('|')) { | ||
tableLineCount++; | ||
if (tableLineCount === 2) { | ||
// Insert the new row after the second row | ||
lines.splice(i + 1, 0, newRow); | ||
break; | ||
} | ||
} | ||
} | ||
|
||
fs.writeFile(mdFilePath, lines.join('\n'), 'utf8', (err) => { | ||
if (err) { | ||
console.error('Error writing the file:', err); | ||
return; | ||
} | ||
console.log('Markdown file updated successfully.'); | ||
}); | ||
}); | ||
} | ||
|
||
// Execute the two main functions | ||
(async () => { | ||
await appendCliTeam(); | ||
updateReleaseHistory(newRow); | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
name: Update Zowe Version and Create PR | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
major_version: | ||
description: 'Major version (default is 3)' | ||
required: true | ||
default: '3' | ||
minor_version: | ||
description: 'Minor version' | ||
required: true | ||
patch_version: | ||
description: 'Patch version' | ||
required: true | ||
|
||
jobs: | ||
update_versions_and_create_pr: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout CLI Repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: lts/* | ||
|
||
- name: Set Variables and Ensure Increase in Semver | ||
id: get_zowe_versions | ||
run: | | ||
current_version=$(jq -r '.zoweVersion' packages/cli/package.json) | ||
current_version="${current_version#v}" # Strip the 'v' prefix | ||
echo "current_version=$current_version" >> $GITHUB_ENV | ||
new_version="${{ github.event.inputs.major_version }}.${{ github.event.inputs.minor_version }}.${{ github.event.inputs.patch_version }}" | ||
echo "new_version=$new_version" >> $GITHUB_ENV | ||
echo "PACKAGE_JSON_PATH=packages/cli/package.json" >> $GITHUB_ENV | ||
if [[ "$new_version" < "$current_version" ]]; then | ||
echo "Error: New version $new_version is not greater than current version $current_version." | ||
exit 1 | ||
fi | ||
- name: Create Branch | ||
run: | | ||
branch_name="update-version-v${{ env.new_version }}" | ||
echo "branch_name=$branch_name" >> $GITHUB_ENV | ||
git checkout -b "$branch_name" | ||
- name: Update Zowe Version in cli/package.json | ||
run: | | ||
jq ".zoweVersion = \"v${{ env.new_version }}\"" ${{ env.PACKAGE_JSON_PATH }} > package.tmp.json && mv package.tmp.json ${{ env.PACKAGE_JSON_PATH }} | ||
- name: Update RELEASE_HISTORY.md | ||
run: node ".github/updateReleaseMarkdown.js" | ||
env: | ||
NEW_VERSION: ${{ env.new_version }} | ||
|
||
- name: Commit and Push Changes | ||
run: | | ||
git config --global user.name "${{ secrets.ZOWE_ROBOT_USER }}" | ||
git config --global user.email "${{ secrets.ZOWE_ROBOT_EMAIL }}" | ||
git add "${{ env.PACKAGE_JSON_PATH }}" | ||
git add "RELEASE_HISTORY.md" | ||
git commit -sm "Update version to ${{ env.new_version }}" | ||
git push origin "$branch_name" | ||
- name: Create Pull Request | ||
run: | | ||
pr_title="Update CLI version to ${{ env.new_version }}" | ||
base_branch="${{ github.ref_name }}" | ||
gh pr create -t "$pr_title" -b "$base_branch" --head "$branch_name" --body "Updating Zowe CLI version to ${{ env.new_version }}" --reviewer zFernand0,t1m0thyj,awharn,gejohnston,traeok,jace-roell,ATorrise | ||
env: | ||
GH_TOKEN: ${{ secrets.ZOWE_ROBOT_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.