-
Notifications
You must be signed in to change notification settings - Fork 903
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1288 from ml5js/joeyklee.devops-publish-workflow
chore: bump pkg - testing automated version bumping
- Loading branch information
Showing
4 changed files
with
48 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |