Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: check for semver changes #49

Merged
merged 5 commits into from
Oct 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions .github/workflows/pullRequest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 1

- name: Use Node.js 18.x
uses: actions/setup-node@v3
Expand Down Expand Up @@ -39,6 +41,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 1

- name: Use Node.js 18.x
uses: actions/setup-node@v3
Expand Down Expand Up @@ -70,6 +74,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 1

- name: Use Node.js 18.x
uses: actions/setup-node@v3
Expand All @@ -95,6 +101,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 1

- name: Use Node.js 18.x
uses: actions/setup-node@v3
Expand All @@ -112,3 +120,47 @@ jobs:

- name: Find dead code
run: yarn deadCode

version-check:
name: Check package version
runs-on: ubuntu-latest
steps:
- name: Checkout PR
uses: actions/checkout@v3
with:
fetch-depth: 1

- name: Checkout main
uses: actions/checkout@v3
with:
ref: main
path: main
fetch-depth: 1

- name: Compare versions
id: version_check
run: |
PR_VERSION=$(node -p "require('./package.json').version")
MAIN_VERSION=$(node -p "require('./main/package.json').version")
if [ "$PR_VERSION" = "$MAIN_VERSION" ]; then
echo "ERROR_MESSAGE=Error: Package version has not been updated" >> $GITHUB_OUTPUT
exit 1
elif ! npx semver -r ">$MAIN_VERSION" "$PR_VERSION" > /dev/null; then
echo "ERROR_MESSAGE=Error: New version ($PR_VERSION) is not greater than current version ($MAIN_VERSION)" >> $GITHUB_OUTPUT
exit 1
else
echo "Package version has been updated correctly"
fi

- name: Comment PR
if: failure()
uses: actions/github-script@v6
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '${{ steps.version_check.outputs.ERROR_MESSAGE }}'
})
11 changes: 10 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 1

- name: Use Node.js 16.x
uses: actions/setup-node@v3
Expand Down Expand Up @@ -41,6 +43,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 1

- name: Use Node.js 16.x
uses: actions/setup-node@v3
Expand Down Expand Up @@ -72,6 +76,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 1

- name: Use Node.js 16.x
uses: actions/setup-node@v3
Expand All @@ -97,6 +103,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 1

- name: Use Node.js 16.x
uses: actions/setup-node@v3
Expand All @@ -122,6 +130,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 1

- name: Use Node.js 16.x
uses: actions/setup-node@v3
Expand All @@ -148,4 +158,3 @@ jobs:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_command: npm publish --access public
generate_release_notes: true

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@arthurgeron/eslint-plugin-react-usememo",
"version": "2.4.1",
"version": "2.4.2",
"description": "",
"main": "dist/index.js",
"author": "Stefano J. Attardi <[email protected]> & Arthur Geron <[email protected]",
Expand Down
Loading