Skip to content

Commit

Permalink
fix: workflow (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
Yehonal authored Feb 19, 2022
1 parent 95044ca commit bdb0da0
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 12 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,16 @@ jobs:
if: github.event.label.name == 'pr-version-bump'
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.ref }}
- name: Test bump action
with:
repository: https://github.dev/Drassil/action-package-version-bump
repository: https://github.com/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: ../../
uses: ./
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Rev: 1.0.0-rc1.1
=============
## Fixes

* workflow fixed




3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# 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


ver 1.1
22 changes: 14 additions & 8 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,27 @@ runs:
ref: ${{ github.event.pull_request.head.ref }}
fetch-depth: 0
- name: Pull and bump version
shell: bash
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`
git pull main-repo ${{ inputs.ref_branch }}
echo "Updating version"
npm version --no-git-tag-version ${{ inputs.version_args }}
PACKAGE_VERSION=`node -e "console.log(require('./package.json').version);"`
echo "Package version: $PACKAGE_VERSION. Getting previous changelog"
PREV_CHANGELOG=`git show main-repo/${{ inputs.ref_branch }}:CHANGELOG.md || true`
echo "Composing new changelog"
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"
echo "Creating commit and pushing"
git add -A
git commit -m "chore: bump package version to $PACKAGE_VERSION and update changelog"
git push --force
using: 'node12'
main: index.js
- name: Run script
shell: bash
run: node index.js


4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "action-package-version-bump",
"version": "1.0.0-rc1.0",
"version": "1.0.0-rc1.1",
"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": {
Expand All @@ -13,4 +13,4 @@
"@actions/exec": "^1.1.0",
"@actions/github": "^5.0.0"
}
}
}

0 comments on commit bdb0da0

Please sign in to comment.