Skip to content

Commit

Permalink
Merge pull request #2268 from zowe/next
Browse files Browse the repository at this point in the history
Move the `next` branch into `master`
  • Loading branch information
zFernand0 authored Sep 19, 2024
2 parents 57e9e72 + 5cdbb17 commit 609c2ff
Show file tree
Hide file tree
Showing 1,107 changed files with 23,177 additions and 57,414 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ module.exports = {
"rules": {
"max-len": ["warn", 150],
"no-console": "error",
"no-extra-parens": "error",
"no-multiple-empty-lines": "warn",
"no-trailing-spaces": "warn",
"@typescript-eslint/ban-types": "off",
Expand Down
65 changes: 65 additions & 0 deletions .github/updateReleaseMarkdown.js
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);
111 changes: 111 additions & 0 deletions .github/updateReleaseMarkdown_BROKEN.js
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);
})();
17 changes: 7 additions & 10 deletions .github/workflows/secrets-sdk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,9 @@ jobs:
settings:
- host: macos-latest
target: x86_64-apple-darwin
build: |
npm run build
build: npm run build -- --target x86_64-apple-darwin
- host: windows-latest
build: npm run build
build: npm run build -- --target x86_64-pc-windows-msvc
target: x86_64-pc-windows-msvc
- host: windows-latest
build: |
Expand Down Expand Up @@ -67,13 +66,7 @@ jobs:
CARGO=cross npm run build -- --target x86_64-unknown-linux-musl
- host: macos-latest
target: aarch64-apple-darwin
build: |
sudo rm -Rf /Library/Developer/CommandLineTools/SDKs/*;
export CC=$(xcrun -f clang);
export CXX=$(xcrun -f clang++);
SYSROOT=$(xcrun --sdk macosx --show-sdk-path);
export CFLAGS="-isysroot $SYSROOT -isystem $SYSROOT";
npm run build -- --target aarch64-apple-darwin
build: npm run build -- --target aarch64-apple-darwin
- host: ubuntu-latest
target: aarch64-unknown-linux-gnu
use-cross: true
Expand Down Expand Up @@ -210,8 +203,11 @@ jobs:
settings:
- host: windows-latest
target: x86_64-pc-windows-msvc
- host: macos-latest
target: aarch64-apple-darwin
- host: macos-latest
target: x86_64-apple-darwin
architecture: x64
- host: ubuntu-latest
target: x86_64-unknown-linux-gnu
- host: ubuntu-latest
Expand All @@ -237,6 +233,7 @@ jobs:
node-version: ${{ matrix.node }}
check-latest: true
cache: npm
architecture: ${{ matrix.settings.architecture }}
- name: Install dependencies
run: npm ci --ignore-scripts
- name: Download artifacts
Expand Down
74 changes: 74 additions & 0 deletions .github/workflows/zoweReleaseVersion.yaml
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 }}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,4 @@ packages/imperative/web-help/dist/css/bundle*
packages/imperative/web-help/dist/js/

jest-stare/
jest.user.config.js
jest.user.config.js
10 changes: 8 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,20 @@ Add an entry to changelog.md for any PR that introduces a feature, enhancement,
**Each changelog entry must:**
- Describe the change and how it impacts end users.
- Include a relevant Issue # or Pull Request #.
- Include one of the following prefixes:
- `BugFix` - If a fix was added
- `Enhancement` - If a feature or enhancement was introduced
- For breaking changes (only allowed for PRs merged into the "next" branch):
- `LTS Breaking` - If behavior has changed since the last LTS release
- `Next Breaking` - If behavior has changed since an earlier vNext prerelease

The following is an example of the markdown that you should insert into the changelog above the last-released version:

```
## Recent Changes

- Document your changes here. [Issue# or PR#](link-to-issue-or-pr)
- Document another change here. [Issue# or PR#](link-to-issue-or-pr)
- BugFix: Describe the bug fix here. [Issue# or PR#](link-to-issue-or-pr)
- Enhancement: Describe the enhancement here. [Issue# or PR#](link-to-issue-or-pr)
```

**Tips:**
Expand Down
Loading

0 comments on commit 609c2ff

Please sign in to comment.