Skip to content

Commit

Permalink
bump version and refactor release process
Browse files Browse the repository at this point in the history
  • Loading branch information
okwolf committed Jan 18, 2021
1 parent 8b62cc4 commit b95e858
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 34 deletions.
19 changes: 10 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@ jobs:
matrix:
node-version: [10.x, 12.x, 14.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: |
npm i -g codecov
npm i
codecov
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: |
npm i -g codecov
npm i
npm run check
codecov
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hyperapp-fx",
"version": "2.0.0-beta.1",
"version": "2.0.0-beta.2",
"description": "Effects for use with Hyperapp",
"main": "dist/hyperappFx.js",
"module": "src/index.js",
Expand All @@ -19,7 +19,7 @@
"uglify-js": "=3.5.2"
},
"scripts": {
"clean": "npx rimraf coverage dist node_modules",
"clean": "npx --ignore-existing --quiet rimraf coverage dist node_modules",
"format": "prettier --write '{src,test}/**/*.js'",
"format:check": "prettier --list-different {src,test}/**/*.js",
"lint": "eslint {src,test}/**/*.js",
Expand All @@ -29,8 +29,8 @@
"minify": "uglifyjs dist/hyperappFx.js -o dist/hyperappFx.js -mc pure_funcs=['Object.defineProperty'] --source-map includeSources,url=hyperappFx.js.map",
"check": "npm run format:check && npm run lint && npm t",
"build": "npm run check && npm run bundle && npm run minify",
"prepare": "npm run build && npm run doc",
"release": "./pre-flight-tests && npm run clean && npm i && ./pre-flight-tests && git tag $npm_package_version && git push && git push --tags && npm publish --tag next"
"release:dry": "npm run clean && npm i && npm run check && npm run build && npm run doc",
"release": "node release"
},
"prettier": {
"semi": false
Expand Down
21 changes: 0 additions & 21 deletions pre-flight-tests

This file was deleted.

32 changes: 32 additions & 0 deletions release.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
const { execSync } = require("child_process");
const { version } = require("./package");
const exec = command => execSync(command, { encoding: "utf8" }).trim();

const exitWithError = error => {
process.stderr.write(`\x1b[1;31m${error}\x1b[0m\n\n`);
process.exit(1);
};

const gitBranchName = exec("git rev-parse --abbrev-ref HEAD");
if (gitBranchName !== "master") {
exitWithError("please checkout the master branch to make a release!");
}

const workingCopyChanges = exec("git status --porcelain");
if (workingCopyChanges) {
exitWithError("please commit your changes before making a release!");
}

const tagExists = exec(`git tag -l "${version}"`);
if (tagExists) {
exitWithError(`${version} has already been released!`);
}

execSync(
`npm run release:dry && git tag ${version} && git push && git push --tags && npm publish`,
{
shell: true,
stdio: "inherit",
cwd: __dirname
}
);

0 comments on commit b95e858

Please sign in to comment.