mirror of
https://github.com/Unleash/unleash.git
synced 2025-04-15 01:16:22 +02:00
chore: add check-relase script as part of perversion validations.
This commit is contained in:
parent
794327f8e0
commit
fe45c69fb6
1
.github/workflows/release.yaml
vendored
1
.github/workflows/release.yaml
vendored
@ -22,7 +22,6 @@ jobs:
|
||||
registry-url: 'https://registry.npmjs.org'
|
||||
- run: |
|
||||
yarn install --frozen-lockfile
|
||||
yarn lint
|
||||
- run: |
|
||||
TAG=$(echo $GITHUB_REF_NAME | grep -oP '^v\d+\.\d+\.\d+-?\K(\w+)?')
|
||||
npm publish --tag ${TAG:-latest}
|
||||
|
@ -57,4 +57,24 @@ The controller takes care of the following:
|
||||
- try/catch RequestHandler method
|
||||
- error handling with proper response code if they fail
|
||||
- `await` the RequestHandler method if it returns a promise (so you don't have to)
|
||||
- access control so that you can just list the required permission for a RequestHandler and the base Controller will make sure the user have these permissions.
|
||||
- access control so that you can just list the required permission for a RequestHandler and the base Controller will make sure the user have these permissions.
|
||||
|
||||
## Creating a release
|
||||
In order to produce a release you will need to be a Unleash core team member and have the Unleash admin role assigned on the Unleash organization on GitHub.
|
||||
|
||||
# Step 1: create a new version tag
|
||||
|
||||
Use npm to set the version in package.json and specify a version tag.
|
||||
|
||||
```sh
|
||||
npm version 3.10.0
|
||||
```
|
||||
|
||||
This command will trigger an internal verification step where we will perform the following steps:
|
||||
|
||||
- *STEP 1. Check unleash-frontend version* - Validate that a latest release of unleash-server does not depend on a pre-release of unleash-frontend (beta, alpha, etc)
|
||||
- *STEP 2. Lint* - Run lint checks on the code.
|
||||
- *STEP 3. Build* - Validate that we are able to build the project
|
||||
- *STEP 4. Test* - Validate that all test runs green.
|
||||
|
||||
If all steps completes a single commit is produced on the main branch where the `version` property in package.json is updated, and a git tag is created to point to that tag specifically.
|
@ -45,7 +45,8 @@
|
||||
"test:coverage:jest": "NODE_ENV=test PORT=4243 jest --silent --ci --json --coverage --testLocationInResults --outputFile=\"report.json\" --forceExit --testTimeout=10000",
|
||||
"seed:setup": "ts-node src/test/e2e/seed/segment.seed.ts",
|
||||
"seed:serve": "UNLEASH_DATABASE_NAME=unleash_test UNLEASH_DATABASE_SCHEMA=seed yarn run start:dev",
|
||||
"clean": "del-cli --force dist"
|
||||
"clean": "del-cli --force dist",
|
||||
"preversion": "./scripts/check-release.sh $npm_package_version"
|
||||
},
|
||||
"jest": {
|
||||
"automock": false,
|
||||
|
29
scripts/check-release.js
Normal file
29
scripts/check-release.js
Normal file
@ -0,0 +1,29 @@
|
||||
const semver = require('semver');
|
||||
//@ts-ignore
|
||||
const pck = require('../package.json');
|
||||
|
||||
const newUnleashVersion = process.argv[2];
|
||||
const frontendVersion = pck.dependencies['unleash-frontend'];
|
||||
|
||||
function isPrerelease(version) {
|
||||
const arr = semver.prerelease(version);
|
||||
return arr && arr.length > 0;
|
||||
}
|
||||
|
||||
if (!newUnleashVersion) {
|
||||
console.error('You must provide the new Unleash version as argument');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
if (!isPrerelease(newUnleashVersion)) {
|
||||
if (isPrerelease(frontendVersion)) {
|
||||
console.error(
|
||||
`A latest version of unleash-server (${newUnleashVersion}) cannot depend on a pre-release of unleash-frontend (${frontendVersion})`,
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
console.log(
|
||||
` Passed!\x1b[36m unleash-server v${newUnleashVersion}\x1b[0m can depend on\x1b[36m unleash-frontend v${frontendVersion}\x1b[0m`,
|
||||
);
|
14
scripts/check-release.sh
Executable file
14
scripts/check-release.sh
Executable file
@ -0,0 +1,14 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
echo -e "\n STEP 1. Check unleash-frontend version"
|
||||
node scripts/check-release.js $1
|
||||
|
||||
echo -e "\n STEP 2. Lint"
|
||||
yarn run lint
|
||||
|
||||
echo -e "\n STEP 3. Build"
|
||||
yarn run build
|
||||
|
||||
echo -e "\n STEP 4. Test"
|
||||
yarn run test
|
@ -76,6 +76,7 @@
|
||||
"snapshots",
|
||||
"coverage",
|
||||
"website",
|
||||
"setupJest.js"
|
||||
"setupJest.js",
|
||||
"scripts"
|
||||
]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user