-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
47394fd
commit 6284010
Showing
4 changed files
with
84 additions
and
1 deletion.
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: Publish Package to npmjs | ||
on: | ||
release: | ||
types: [published] | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
# Setup .npmrc file to publish to npm | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: '20.x' | ||
registry-url: 'https://registry.npmjs.org' | ||
- run: npm ci | ||
- run: npm publish | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: Update Version | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
update-version: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: '17' | ||
|
||
- name: Increment version | ||
id: increment-version | ||
run: | | ||
npm run ver-sync increment | ||
- name: Commit and push changes | ||
run: | | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "GitHub Action" | ||
git add . | ||
git commit -m "Update version" | ||
git push | ||
#- name: Merge development -> staging | ||
# uses: devmasx/merge-branch@master | ||
# with: | ||
# type: now | ||
# from_branch: production | ||
# target_branch: master | ||
# github_token: ${{ secrets.GITHUB_TOKEN }} |
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import packageJson from "../package.json" assert { type: "json" }; | ||
import fs from "fs"; | ||
|
||
// check if --increment flag is set | ||
const increment = process.argv.includes("increment"); | ||
|
||
// read version and versionCode from package.json | ||
let version = packageJson.version; | ||
|
||
if (increment) { | ||
console.log("=== Incrementing version ==="); | ||
// increment version | ||
const versionParts = version.split("."); | ||
const lastVersionPart = versionParts.pop(); | ||
versionParts.push(parseInt(lastVersionPart) + 1); | ||
version = versionParts.join("."); | ||
|
||
// update package.json | ||
packageJson.version = version; | ||
|
||
// write package.json | ||
fs.writeFileSync("package.json", JSON.stringify(packageJson, null, 2)); | ||
} | ||
|
||
console.log("=== Version updated to " + version + " ==="); |