Skip to content

Commit

Permalink
Merge pull request #1288 from ml5js/joeyklee.devops-publish-workflow
Browse files Browse the repository at this point in the history
chore: bump pkg - testing automated version bumping
  • Loading branch information
joeyklee authored Feb 3, 2022
2 parents 289b78d + f1972c7 commit 13be48e
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 16 deletions.
22 changes: 19 additions & 3 deletions .github/workflows/debugging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,26 @@ jobs:
id: release_drafter
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# bump the package version
- run: echo "name ${{ steps.release_drafter.outputs.name }}"
- run: echo "tag_name ${{ steps.release_drafter.outputs.tag_name }}"
- run: echo "id ${{ steps.release_drafter.outputs.id }}"
# - run: npm ci
# - run: npm run update:packageVersion ${{ steps.release_drafter.outputs.name }}
# # update the readme
# - run: npm run update:readme
# # install to update package-lock.json
# # - run: npm ci
# - name: Commit
# run: |
# git config --global user.name 'ml5'
# git config --global user.email '[email protected]'
# git commit -am "bumps package, readme, and package-lock"
# - name: Push changes
# uses: ad-m/github-push-action@master
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# branch: ${{ github.ref }}
# - run: echo "passed npm ci"
# run the build
# - run: npm run build
# - run: echo "passed build"
# run the build
# - run: npm publish ${{ steps.release_drafter.outputs.tag_name }}
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ Before getting started with ml5.js, review our [Code of Conduct](https://github.










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










Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"test:single": "./node_modules/karma/bin/karma start karma.conf.js --single-run",
"test-travis": "./scripts/test-travis.sh",
"serve:docs": "docsify serve docs",
"update:packageVersion": "node ./scripts/updatePackageVersion.js",
"update:readme": "node ./scripts/updateReadme.js",
"update:docs": "node ./scripts/updateDocVersions.js $oldversion",
"publish:npm": "npm run build && npm publish",
Expand Down
33 changes: 20 additions & 13 deletions scripts/updatePackageVersion.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,31 @@
const fs = require('fs');
/**
* USAGE:
* # if using NPM run
* $ npm run update:packageVersion -- v0.9.4
*
* # if using just node
* $ node updatePackageVersion.js v0.9.4
*/

const newVersionNumber = process.env.newversion;
const fs = require("fs");

function checkVersionGiven(){
if(newVersionNumber === undefined){
console.log('🔥🔥🔥submit the new version number 🔥🔥🔥');
process.exit(22);
}
const newVersionNumber = process.argv[2];

function checkVersionGiven() {
if (newVersionNumber === undefined) {
console.log("🔥🔥🔥submit the new version number 🔥🔥🔥");
process.exit(22);
}
}

function updatePackageVersion(fpath){
function updatePackageVersion(fpath) {
checkVersionGiven();
let packageJson = fs.readFileSync(fpath);
packageJson = JSON.parse(packageJson);
packageJson.version = newVersionNumber;

packageJson.version = newVersionNumber.replace(/v/g, "");

fs.writeFileSync(fpath, JSON.stringify(packageJson, null, 2));

}
updatePackageVersion('./package.json')
updatePackageVersion("./package.json");

// module.exports = updatePackageVersion;
module.exports = updatePackageVersion;

0 comments on commit 13be48e

Please sign in to comment.