forked from NineBit-Computing/fundamental-ngx
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(ci): ci optimizations (SAP#8662)
* feat: implemented new ci pipelines and optimized them * chore(ci): deleted unused token * chore(ci): fixed firebase tokens * chore(ci): added --runner cloud to the commands * chore(deps): fixed merge broken dependency * chore(deps): added cacheable operations to the nx.json * chore(deps): deleted local runner * chore(ci): deleted cloud runner refs * chore(ci): fixed lint issues * chore(ci): updated netlify build script * chore(ci): replaced http://placeimg.com to secure version * chore(ci): added read-only token for local cloud runner * feat(ci): there is no point in building doc pages * feat(ci): there is no point in using builder from nrwl * feat(ci): removed buildable from template docs * chore: nx formatting * feat(ci): excluded docs from build in one step * chore(ci): turns out nrwl executor works just fine * chore(ci): fixed most of illustrated-message-docs examples * chore(ci): modified how ci-env flags are generated * chore(ci): added schema property to the angular.json * fix(docs): update NEW_COMPONENT.md * fix(docs): missed a few things * chore: added prepare target dependency * chore: removed runner cloud from ci scripts * feat: removed redundant scripts from package.json * feat: added back netlify build script * feat: deleted unused files * feat: deleted unnecessary screenshots * feat: deleted unnecessary PLATFORM_README and replaced its usage with platform/Readme version * feat: deleted unnecessary PLATFORM_README copy step from platform project.json * feat: removed unnecessary copyReadme step from prepare executor * feat: moved new component doc to the shared docs file, so file modifications now trigger app cache invalidation * feat: added implicit dependency from app to umbrella libs so that changes to readmes are also triggering app rebuild * chore: ran nx format:write against main * feat: added missing implicit dependencies Co-authored-by: Mike O'Donnell <[email protected]> Co-authored-by: Inna Atanasova <[email protected]>
- Loading branch information
1 parent
1404077
commit 459f442
Showing
12,174 changed files
with
49,951 additions
and
43,546 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
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 |
---|---|---|
|
@@ -17,4 +17,4 @@ trim_trailing_whitespace = false | |
|
||
|
||
[*.json] | ||
indent_size = 2 | ||
indent_size = 4 |
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,27 @@ | ||
name: Action for semantic version bump | ||
description: Bump version of root package.json | ||
|
||
inputs: | ||
isPrerelease: | ||
description: Whether this is a prerelease | ||
required: false | ||
default: 'false' | ||
isHotfix: | ||
description: Whether this is a hotfix | ||
required: false | ||
default: 'false' | ||
writeFile: | ||
description: Write to package.json | ||
required: false | ||
default: 'false' | ||
outputs: | ||
newVersion: | ||
description: New version | ||
isPrerelease: | ||
description: Is prerelease version | ||
releaseTag: | ||
description: Release tag | ||
|
||
runs: | ||
using: node16 | ||
main: ./index.js |
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,110 @@ | ||
const recommendedVersion = require('conventional-recommended-bump'); | ||
const semver = require('semver'); | ||
const fs = require('fs'); | ||
const core = require('@actions/core'); | ||
const { getInput } = require('@actions/core'); | ||
const packageJson = JSON.parse(fs.readFileSync('./package.json', 'utf8')); | ||
const releaseType = core.getInput('isPrerelease') !== 'false' ? 'prerelease' : 'release'; | ||
const writeFile = core.getInput('writeFile') !== 'false'; | ||
const isHotfix = getInput('isHotfix') !== 'false'; | ||
const currentVersion = packageJson.version; | ||
const prereleaseRequested = releaseType === 'prerelease'; | ||
|
||
function isInPrerelease(version) { | ||
return Array.isArray(semver.prerelease(version)); | ||
} | ||
|
||
function shouldContinuePrerelease(version, expectType) { | ||
return getCurrentActiveType(version) === expectType; | ||
} | ||
|
||
const TypeList = ['major', 'minor', 'patch'].reverse(); | ||
|
||
/** | ||
* extract the in-pre-release type in target version | ||
* | ||
* @param version | ||
* @return {string} | ||
*/ | ||
function getCurrentActiveType(version) { | ||
const typelist = TypeList; | ||
for (let i = 0; i < typelist.length; i++) { | ||
if (semver[typelist[i]](version)) { | ||
return typelist[i]; | ||
} | ||
} | ||
} | ||
|
||
/** | ||
* calculate the priority of release type, | ||
* major - 2, minor - 1, patch - 0 | ||
* | ||
* @param type | ||
* @return {number} | ||
*/ | ||
function getTypePriority(type) { | ||
return TypeList.indexOf(type); | ||
} | ||
|
||
const bumpedVersionType = () => { | ||
return new Promise((resolve, reject) => { | ||
recommendedVersion( | ||
{ | ||
preset: { | ||
name: require.resolve('conventional-changelog-conventionalcommits'), | ||
preMajor: semver.lt(currentVersion, '1.0.0') | ||
}, | ||
tagPrefix: 'v' | ||
}, | ||
(err, release) => { | ||
if (err) { | ||
return reject(err); | ||
} | ||
if (prereleaseRequested) { | ||
if (isInPrerelease(currentVersion)) { | ||
if ( | ||
shouldContinuePrerelease(currentVersion, release.releaseType) || | ||
getTypePriority(getCurrentActiveType(currentVersion)) > getTypePriority(release.releaseType) | ||
) { | ||
release.releaseType = 'prerelease'; | ||
return resolve(release); | ||
} | ||
} | ||
release.releaseType = 'pre' + release.releaseType; | ||
return resolve(release); | ||
} | ||
return resolve(release); | ||
} | ||
); | ||
}); | ||
}; | ||
|
||
const getReleaseTag = (hotfix, preRelease) => { | ||
if (hotfix) { | ||
return 'archive'; | ||
} | ||
if (preRelease) { | ||
return 'prerelease'; | ||
} | ||
return 'latest'; | ||
}; | ||
|
||
const run = async () => { | ||
const release = await bumpedVersionType(); | ||
core.info(`${release.reason}, therefore release type should be ${release.releaseType}`); | ||
|
||
const newVersion = | ||
semver.valid(release.releaseType, undefined) || | ||
semver.inc(currentVersion, release.releaseType, prereleaseRequested, 'rc'); | ||
core.info(`new version is ${newVersion}`); | ||
if (writeFile) { | ||
packageJson.version = newVersion; | ||
fs.writeFileSync('./package.json', JSON.stringify(packageJson, null, 2)); | ||
} | ||
const isPrerelease = !!semver.prerelease(newVersion, undefined); | ||
core.setOutput('newVersion', newVersion); | ||
core.setOutput('isPrerelease', isPrerelease.toString()); | ||
core.setOutput('releaseTag', getReleaseTag(isHotfix, isPrerelease)); | ||
}; | ||
|
||
run(); |
10 changes: 10 additions & 0 deletions
10
.github/actions/generate-conventional-release-notes/action.yml
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,10 @@ | ||
name: Generate changelog | ||
description: Generates changelog from nearest release to current commit | ||
|
||
outputs: | ||
generatedChangelog: | ||
description: Generated changelog | ||
|
||
runs: | ||
using: node16 | ||
main: ./index.js |
31 changes: 31 additions & 0 deletions
31
.github/actions/generate-conventional-release-notes/closest-version.js
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,31 @@ | ||
const semver = require('semver'); | ||
const fs = require('fs'); | ||
const gitSemverTags = require('git-semver-tags'); | ||
|
||
const packageJson = JSON.parse(fs.readFileSync('./package.json', 'utf8')); | ||
|
||
const semverTags = (maxVersion) => { | ||
return new Promise((resolve, reject) => { | ||
gitSemverTags({ tagPrefix: 'v', skipUnstable: false }, function (err, result) { | ||
if (err) { | ||
reject(err); | ||
} else { | ||
const firstLessIndex = result.findIndex((v) => semver.lt(v, maxVersion)); | ||
resolve(result.slice(firstLessIndex, result.length)); | ||
} | ||
}); | ||
}); | ||
}; | ||
|
||
module.exports = async () => { | ||
const isPrerelease = !!semver.prerelease(packageJson.version); | ||
const availableVersions = await semverTags(packageJson.version); | ||
let closestIndex = 0; | ||
if (!isPrerelease) { | ||
closestIndex = availableVersions.findIndex((v) => !semver.prerelease(v)); | ||
} | ||
return { | ||
closest: availableVersions[closestIndex], | ||
tagsTillClosest: availableVersions.slice(0, closestIndex) | ||
}; | ||
}; |
34 changes: 34 additions & 0 deletions
34
.github/actions/generate-conventional-release-notes/index.js
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,34 @@ | ||
const conventionalChangelog = require('conventional-changelog'); | ||
const core = require('@actions/core'); | ||
const through = require('through2'); | ||
const closestVersion = require('./closest-version'); | ||
const childProcess = require('child_process'); | ||
|
||
const run = async () => { | ||
const { closest, tagsTillClosest } = await closestVersion(); | ||
childProcess.execSync(`git tag -d ${tagsTillClosest.join(' ')}`); | ||
const changelog = await conventionalChangelog( | ||
{ | ||
preset: 'angular', | ||
releaseCount: 1 | ||
}, | ||
null, | ||
{ from: closest }, | ||
null, | ||
{ headerPartial: '' } | ||
); | ||
let generatedReleaseNotes = ''; | ||
changelog | ||
.pipe( | ||
through(function (chunk, _enc, callback) { | ||
this.push(chunk); | ||
generatedReleaseNotes += chunk.toString(); | ||
callback(); | ||
}) | ||
) | ||
.on('finish', () => { | ||
core.setOutput('generatedReleaseNotes', generatedReleaseNotes); | ||
}); | ||
}; | ||
|
||
run(); |
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,16 @@ | ||
name: Publish library | ||
description: Publish library to npm repository | ||
inputs: | ||
projects: | ||
description: Path to package.json | ||
required: true | ||
releaseTag: | ||
description: Release tag of publish | ||
required: true | ||
token: | ||
description: NPM token | ||
required: true | ||
|
||
runs: | ||
using: node16 | ||
main: ./index.js |
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,30 @@ | ||
const { getInput, info } = require('@actions/core'); | ||
const { npmPublish } = require('@jsdevtools/npm-publish'); | ||
const { readFileSync } = require('fs'); | ||
const { resolve } = require('path'); | ||
|
||
const run = async () => { | ||
const projectsMap = JSON.parse(readFileSync('./angular.json', { encoding: 'utf-8' })).projects; | ||
const projects = JSON.parse('["core", "i18n", "platform", "fn", "moment-adapter", "datetime-adapter"]').map( | ||
(projectName) => { | ||
const ngPackage = JSON.parse( | ||
readFileSync(`${projectsMap[projectName]}/ng-package.json`, { encoding: 'utf-8' }) | ||
); | ||
return resolve(projectsMap[projectName], ngPackage.dest, 'package.json'); | ||
} | ||
); | ||
const tag = getInput('releaseTag'); | ||
const npmToken = getInput('token'); | ||
|
||
for (const packageJsonPath of projects) { | ||
const result = await npmPublish({ | ||
package: packageJsonPath, | ||
token: npmToken, | ||
tag, | ||
dryRun: true | ||
}); | ||
info(`Published ${result.package}@${result.version}`); | ||
} | ||
}; | ||
|
||
run().catch((e) => console.log(e)); |
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,34 @@ | ||
name: Preparing command utils | ||
description: Command utils | ||
|
||
inputs: | ||
parallel-commands: | ||
description: Parallel commands | ||
required: true | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Prepare command utils | ||
run: chmod +x ./.github/actions/parallel-commands/run-commands-in-parallel.sh | ||
shell: bash | ||
- name: Process parallel commands configuration | ||
uses: actions/github-script@v6 | ||
id: commands | ||
env: | ||
PARALLEL_COMMANDS: ${{ inputs.parallel-commands }} | ||
with: | ||
script: | | ||
const parallelCommands = (process.env.PARALLEL_COMMANDS || '').split('\n') | ||
.map(command => command.trim()) | ||
.filter(command => command.length > 0) | ||
.map(s => s.replace(/'/g, '%27')); | ||
const stringifiedEncodedArrayOfCommands = JSON.stringify(parallelCommands) | ||
.replace(/%27/g, "'\\''"); | ||
return stringifiedEncodedArrayOfCommands | ||
result-encoding: string | ||
- name: Run commands in parallel | ||
run: ./.github/actions/parallel-commands/run-commands-in-parallel.sh '${{ steps.commands.outputs.result }}' | ||
shell: bash |
19 changes: 19 additions & 0 deletions
19
.github/actions/parallel-commands/run-commands-in-parallel.sh
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,19 @@ | ||
# Extract the provided commands from the stringified JSON array. | ||
IFS=$' | ||
' read -d '' -a userCommands < <((jq -c -r '.[]') <<<"$1") | ||
|
||
# Invoke the provided commands in parallel and collect their exit codes. | ||
pids=() | ||
for userCommand in "${userCommands[@]}"; do | ||
eval "$userCommand" & pids+=($!) | ||
done | ||
|
||
# If any one of the invoked commands exited with a non-zero exit code, exit the whole thing with code 1. | ||
for pid in ${pids[*]}; do | ||
if ! wait $pid; then | ||
exit 1 | ||
fi | ||
done | ||
|
||
# All the invoked commands must have exited with code zero. | ||
exit 0 |
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,18 @@ | ||
name: Set up git user | ||
description: Action for setting up git user | ||
inputs: | ||
name: | ||
description: Github user name | ||
required: true | ||
email: | ||
description: Github email | ||
required: true | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Set up git user | ||
run: | | ||
git config --global user.email "${{ inputs.email }}" | ||
git config --global user.name "${{ inputs.name }}" | ||
shell: bash |
Oops, something went wrong.