mirror of
https://github.com/rive-app/rive-react.git
synced 2026-03-13 08:22:30 +08:00
add release it for automated github releases and npm publish
This commit is contained in:
12
.github/workflows/publish.yml
vendored
12
.github/workflows/publish.yml
vendored
@@ -23,7 +23,13 @@ jobs:
|
||||
run: npm test
|
||||
- name: Build
|
||||
run: npm build
|
||||
- name: Publish
|
||||
- name: Git config
|
||||
run: |
|
||||
git config --local user.email 'hello@rive.app'
|
||||
git config --local user.name ${{ github.actor }}
|
||||
- name: Authenticate with registry
|
||||
run: npm config set //registry.npmjs.org/:_authToken ${{ secrets.NPM_TOKEN }}
|
||||
- name: Release
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
run: npm run publish
|
||||
GITHUB_TOKEN: ${{ secrets.REPO_TOKEN }}
|
||||
run: npm run release
|
||||
|
||||
12
.release-it.json
Normal file
12
.release-it.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"git": {
|
||||
"commitMessage": "chore: release ${version}",
|
||||
"tagName": "v${version}"
|
||||
},
|
||||
"npm": {
|
||||
"publish": true
|
||||
},
|
||||
"github": {
|
||||
"release": true
|
||||
}
|
||||
}
|
||||
1590
package-lock.json
generated
1590
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -10,7 +10,7 @@
|
||||
"lint": "eslint -c .eslintrc.js 'src/**/*{.ts,.tsx}'",
|
||||
"format": "prettier --write src",
|
||||
"types:check": "tsc --noEmit",
|
||||
"publish": "./scripts/publish.sh"
|
||||
"release": "release-it"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
const fs = require('fs');
|
||||
const package = require('../package.json');
|
||||
|
||||
function parseVersion(v) {
|
||||
return v.split('.').map((n) => Number.parseInt(n, 10));
|
||||
}
|
||||
|
||||
const packageVersion = parseVersion(package.version);
|
||||
// Last version seems to always be latest.
|
||||
const publishedVersion = parseVersion(JSON.parse(process.argv[2]).pop());
|
||||
|
||||
const isGreater = (first, second) => {
|
||||
// Assumes first and second have same number of version number
|
||||
const zipped = first.map((n, i) => [n, second[i]]);
|
||||
return zipped.some(([a, b]) => a > b);
|
||||
};
|
||||
|
||||
// If package version is greater than what's published, we use that.
|
||||
if (isGreater(packageVersion, publishedVersion)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Otherwise increment the publishedVersions patch number and push to the package.json
|
||||
const newVersion = publishedVersion;
|
||||
newVersion[2]++;
|
||||
package.version = newVersion.join('.');
|
||||
fs.writeFileSync('./package.json', JSON.stringify(package, null, 2));
|
||||
@@ -1,5 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
NPM_VERSIONS=`npm show rive-react versions --json`
|
||||
node ./scripts/next_version.js "$NPM_VERSIONS"
|
||||
npm publish
|
||||
Reference in New Issue
Block a user