Skip to content

Commit

Permalink
Merge pull request #227 from TiborUdvari/ci/standard-version-swap
Browse files Browse the repository at this point in the history
CI releases improvement
  • Loading branch information
TiborUdvari authored Sep 10, 2024
2 parents 691f9cc + 0cca174 commit 282111f
Show file tree
Hide file tree
Showing 5 changed files with 1,627 additions and 1,002 deletions.
26 changes: 14 additions & 12 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: '18'
node-version: '20'
registry-url: 'https://registry.npmjs.org'

- name: Install dependencies
Expand All @@ -26,21 +26,23 @@ jobs:
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
- name: Check for release notes
run: |
RELEASE_NOTES="$(npm run release -- --dry-run | awk 'BEGIN { flag=0 } /^---$/ { if (flag == 0) { flag=1 } else { flag=2 }; next } flag == 1')"
# Don't release if there are no changes
if [ "$(echo "$RELEASE_NOTES" | wc -l)" -eq 1 ] ; then
echo "This release would have no release notes. Does it include changes?"
echo " - You must have at least one fix / feat commit to generate release notes"
echo "*** STOPPING RELEASE PROCESS ***"
exit 1
fi
- name: Generate release version
run: npm run release
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_KEY }}

- name: Check if version was bumped
run: |
LAST_TAG=$(git describe --tags --abbrev=0)
HEAD_TAG=$(git describe --tags)
if [ "$LAST_TAG" == "$HEAD_TAG" ]; then
echo "No new version detected, skipping push and publish."
exit 0
fi
- name: Push version changes
run: |
git push --follow-tags origin main
Expand Down
13 changes: 13 additions & 0 deletions .versionrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"types": [
{ "type": "feat", "section": "Features" },
{ "type": "fix", "section": "Bug Fixes" },
{ "type": "docs", "section": "Documentation", "hidden": true },
{ "type": "style", "section": "Styling", "hidden": true },
{ "type": "refactor", "section": "Code Refactoring", "hidden": true },
{ "type": "perf", "section": "Performance Improvements" },
{ "type": "test", "section": "Tests", "hidden": true },
{ "type": "ci", "section": "Continuous Integration", "hidden": true },
{ "type": "chore", "section": "Chores", "hidden": true }
]
}
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### 0.4.12 (2024-09-10)

### 0.4.11 (2024-09-10)

### 0.4.10 (2024-09-08)
Expand Down
Loading

0 comments on commit 282111f

Please sign in to comment.