Skip to content

Commit

Permalink
Attempt to fix npm publish workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanlohxz committed Apr 12, 2024
1 parent 92d6cc0 commit c27e9a1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 22 deletions.
34 changes: 13 additions & 21 deletions .github/workflows/publish-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,35 +7,27 @@ on:

jobs:
verify:
name: Verify should publish
name: Publish if pkg version changed
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: main
submodules: recursive
- name: Verify version has changed

- name: Get package version
id: get_pkg_version
run: echo "pkg_version=$(cat package.json | jq -r .version)" >> "$GITHUB_OUTPUT"

- name: Get npm version
id: get_npm_version
run: echo "npm_version=$(npm view java-slang version)" >> "$GITHUB_OUTPUT"

- name: Stop if version has not changed
if: steps.get_pkg_version.outputs.pkg_version == steps.get_npm_version.outputs.npm_version
# We use jq as `npm pkg get version` returns a quoted string
run: |
if [ "$(cat package.json | jq -r .version)" == "$(npm view java-slang version)" ]; then
echo "Version has not changed"
echo "UPDATE=false" >> "$GITHUB_OUTPUT"
else
echo "Version has changed";
echo "UPDATE=true" >> "$GITHUB_OUTPUT"
fi
publish:
name: Publish to npm
needs: [verify]
if: ${{ needs.verify.outputs.UPDATE == 'true' }}
runs-on: ubuntu-latestg
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: main
submodules: recursive
run: exit 1
- name: Setup Node.js
uses: actions/setup-node@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "java-slang",
"version": "1.0.9",
"version": "1.0.10",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"files": ["dist"],
Expand Down

1 comment on commit c27e9a1

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements 76.2% 6847/8985
🟡 Branches 64.51% 2205/3418
🟡 Functions 75.6% 1193/1578
🟡 Lines 76.56% 6498/8487

Test suite run success

1074 tests passing in 52 suites.

Report generated by 🧪jest coverage report action from c27e9a1

Please sign in to comment.