Skip to content

Commit 13be48e

Browse files
authored
Merge pull request #1288 from ml5js/joeyklee.devops-publish-workflow
chore: bump pkg - testing automated version bumping
2 parents 289b78d + f1972c7 commit 13be48e

File tree

4 files changed

+48
-16
lines changed

4 files changed

+48
-16
lines changed

.github/workflows/debugging.yml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,26 @@ jobs:
2424
id: release_drafter
2525
env:
2626
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27+
# bump the package version
2728
- run: echo "name ${{ steps.release_drafter.outputs.name }}"
28-
- run: echo "tag_name ${{ steps.release_drafter.outputs.tag_name }}"
29-
- run: echo "id ${{ steps.release_drafter.outputs.id }}"
30-
# - run: npm ci
29+
# - run: npm run update:packageVersion ${{ steps.release_drafter.outputs.name }}
30+
# # update the readme
31+
# - run: npm run update:readme
32+
# # install to update package-lock.json
33+
# # - run: npm ci
34+
# - name: Commit
35+
# run: |
36+
# git config --global user.name 'ml5'
37+
# git config --global user.email '[email protected]'
38+
# git commit -am "bumps package, readme, and package-lock"
39+
# - name: Push changes
40+
# uses: ad-m/github-push-action@master
41+
# with:
42+
# github_token: ${{ secrets.GITHUB_TOKEN }}
43+
# branch: ${{ github.ref }}
3144
# - run: echo "passed npm ci"
45+
# run the build
3246
# - run: npm run build
3347
# - run: echo "passed build"
48+
# run the build
49+
# - run: npm publish ${{ steps.release_drafter.outputs.tag_name }}

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ Before getting started with ml5.js, review our [Code of Conduct](https://github.
4545

4646

4747

48+
49+
50+
51+
4852

4953

5054

@@ -75,6 +79,10 @@ Before getting started with ml5.js, review our [Code of Conduct](https://github.
7579

7680

7781

82+
83+
84+
85+
7886

7987

8088

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"test:single": "./node_modules/karma/bin/karma start karma.conf.js --single-run",
2121
"test-travis": "./scripts/test-travis.sh",
2222
"serve:docs": "docsify serve docs",
23+
"update:packageVersion": "node ./scripts/updatePackageVersion.js",
2324
"update:readme": "node ./scripts/updateReadme.js",
2425
"update:docs": "node ./scripts/updateDocVersions.js $oldversion",
2526
"publish:npm": "npm run build && npm publish",

scripts/updatePackageVersion.js

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,31 @@
1-
const fs = require('fs');
1+
/**
2+
* USAGE:
3+
* # if using NPM run
4+
* $ npm run update:packageVersion -- v0.9.4
5+
*
6+
* # if using just node
7+
* $ node updatePackageVersion.js v0.9.4
8+
*/
29

3-
const newVersionNumber = process.env.newversion;
10+
const fs = require("fs");
411

5-
function checkVersionGiven(){
6-
if(newVersionNumber === undefined){
7-
console.log('🔥🔥🔥submit the new version number 🔥🔥🔥');
8-
process.exit(22);
9-
}
12+
const newVersionNumber = process.argv[2];
13+
14+
function checkVersionGiven() {
15+
if (newVersionNumber === undefined) {
16+
console.log("🔥🔥🔥submit the new version number 🔥🔥🔥");
17+
process.exit(22);
18+
}
1019
}
1120

12-
function updatePackageVersion(fpath){
21+
function updatePackageVersion(fpath) {
1322
checkVersionGiven();
1423
let packageJson = fs.readFileSync(fpath);
1524
packageJson = JSON.parse(packageJson);
16-
packageJson.version = newVersionNumber;
17-
25+
packageJson.version = newVersionNumber.replace(/v/g, "");
1826

1927
fs.writeFileSync(fpath, JSON.stringify(packageJson, null, 2));
20-
2128
}
22-
updatePackageVersion('./package.json')
29+
updatePackageVersion("./package.json");
2330

24-
// module.exports = updatePackageVersion;
31+
module.exports = updatePackageVersion;

0 commit comments

Comments
 (0)