-
Notifications
You must be signed in to change notification settings - Fork 2
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
Showing
8 changed files
with
130 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
module.exports = { | ||
extends: 'eslint:recommended', | ||
parserOptions: { | ||
project: 'jsconfig.json', | ||
ecmaVersion: 2018, | ||
}, | ||
root: true, | ||
env: { | ||
commonjs: true, | ||
node: true, | ||
}, | ||
}; |
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,22 @@ | ||
name: Version bump (test) | ||
on: | ||
pull_request: | ||
types: | ||
- labeled | ||
env: | ||
NODE_VERSION: 16 | ||
RC_VERSION: 1 | ||
jobs: | ||
version-bump: | ||
runs-on: [ubuntu-latest] | ||
steps: | ||
- name: Test bump action | ||
with: | ||
repository: https://github.dev/Drassil/action-package-version-bump | ||
user_name: 'drassil-git-bot' | ||
user_email: '[email protected]' | ||
ref_branch: 'main' | ||
use_rebase: true | ||
version_args: 'prerelease --preid=rc${{ env.RC_VERSION }}' | ||
node_version: ${{ env.NODE_VERSION }} | ||
uses: ../../ |
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 @@ | ||
node_modules |
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,2 +1,3 @@ | ||
# action-package-version-bump | ||
|
||
Github action to upgrade the package.json version and create a changelog based on PR description that can be triggered in your workflows |
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,58 @@ | ||
name: 'action-package-version-bump' | ||
description: 'Github action to upgrade the package.json version and create a changelog based on PR description that can be triggered in your workflows' | ||
inputs: | ||
repository: | ||
description: 'The repository where to pull the changes' | ||
required: true | ||
user_name: | ||
description: 'Name of the git user to push the changes' | ||
required: true | ||
user_email: | ||
description: 'Email of the git user to push the changes' | ||
required: true | ||
ref_branch: | ||
description: 'Branch to use as a base reference for the version bump' | ||
required: false | ||
default: 'master' | ||
use_rebase: | ||
description: 'Use rebase strategy for pull' | ||
required: false | ||
default: false | ||
version_args: | ||
description: 'npm version command arguments. ' | ||
required: false | ||
default: 'patch' | ||
node_version: | ||
description: 'node version used for the npm commands' | ||
required: false | ||
default: '16' | ||
runs: | ||
using: 'composite' | ||
steps: | ||
- name: Use Node.js | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: ${{ inputs.node_version }} | ||
- uses: actions/checkout@v2 | ||
with: | ||
ref: ${{ github.event.pull_request.head.ref }} | ||
fetch-depth: 0 | ||
- name: Pull and bump version | ||
run: | | ||
git remote add main-repo ${{ inputs.repository }} | ||
git config --global user.name ${{ inputs.user_name }} | ||
git config --global user.email ${{ inputs.user_email }} | ||
git config --global pull.rebase ${{ inputs.use_rebase }} | ||
git pull main-repo | ||
npm version ${{ inputs.version_arguments }} | ||
PACKAGE_VERSION=`npm run --silent version` | ||
PREV_CHANGELOG=`git show main-repo/dev:CHANGELOG.md || true` | ||
echo -e "Rev: $PACKAGE_VERSION\n=============\n ${{ github.event.pull_request.body }}\n\n\n" > CHANGELOG.md | ||
echo -e "$PREV_CHANGELOG" >> CHANGELOG.md | ||
git add -u | ||
git commit -m "chore: bump version and changelog" | ||
git push --force | ||
using: 'node12' | ||
main: index.js | ||
|
||
|
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,2 @@ | ||
// nothing to do for now. It's a placeholder | ||
console.log("Done") |
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 @@ | ||
{ | ||
"compilerOptions": { | ||
"module": "commonjs", | ||
"target": "es6", | ||
"strict": true, | ||
"strictNullChecks": true, | ||
"noUnusedLocals": true, | ||
"noUnusedParameters": true, | ||
"noImplicitReturns": true, | ||
}, | ||
"exclude": [ | ||
"**/node_modules" | ||
], | ||
"include": [ | ||
"index.js", | ||
"src/**/*.js" | ||
] | ||
} |
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,16 @@ | ||
{ | ||
"name": "action-package-version-bump", | ||
"version": "1.0.0-rc1.0", | ||
"description": "Github action to upgrade the package.json version and create a changelog based on PR description that can be triggered in your workflows", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"author": "", | ||
"license": "MIT", | ||
"dependencies": { | ||
"@actions/core": "^1.4.0", | ||
"@actions/exec": "^1.1.0", | ||
"@actions/github": "^5.0.0" | ||
} | ||
} |