Skip to content

Commit

Permalink
try to fix npm in gh action
Browse files Browse the repository at this point in the history
  • Loading branch information
rmorshea committed Jun 3, 2023
1 parent b153430 commit fe6b620
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/.hatch-run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ on:
required: false
type: string
default: '["3.x"]'
uses-secrets:
type: boolean
default: false
secrets:
node-auth-token:
required: false
Expand All @@ -36,9 +39,14 @@ jobs:
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
if: ${{ inputs.uses-secrets }}}
with:
node-version: "14.x"
registry-url: "https://registry.npmjs.org"
- uses: actions/setup-node@v2
if: ${{ inputs.uses-secrets }}}
with:
node-version: "14.x"
- name: Pin NPM Version
run: npm install -g [email protected]
- name: Use Python ${{ matrix.python-version }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ jobs:
with:
job-name: "publish"
hatch-run: "publish"
uses-secrets: true
secrets:
node-auth-token: ${{ secrets.NODE_AUTH_TOKEN }}
pypi-username: ${{ secrets.PYPI_USERNAME }}
Expand Down
6 changes: 3 additions & 3 deletions src/py/reactpy/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["hatchling", "hatch-build-scripts>=0.0.3"]
requires = ["hatchling", "hatch-build-scripts>=0.0.4"]
build-backend = "hatchling.build"

# --- Project --------------------------------------------------------------------------
Expand Down Expand Up @@ -76,7 +76,7 @@ path = "reactpy/__init__.py"

[tool.hatch.envs.default]
features = ["all"]
pre-install-command = "hatch run build --hooks-only"
pre-install-command = "hatch build --hooks-only"
dependencies = [
"coverage[toml]>=6.5",
"pytest",
Expand Down Expand Up @@ -125,7 +125,7 @@ all = ["types"]
work_dir = "../../js"
out_dir = "reactpy/_static"
commands = [
"npm install",
"npm ci",
"npm run build"
]
artifacts = [
Expand Down
8 changes: 6 additions & 2 deletions tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,11 @@ def lint_js(context: Context, fix: bool = False):
@task
def test_py(context: Context, no_cov: bool = False):
"""Run test suites"""
in_py(context, f"hatch run {'test' if no_cov else 'cov'} --maxfail=3")
in_py(
context,
"hatch build --hooks-only",
f"hatch run {'test' if no_cov else 'cov'} --maxfail=3",
)


@task(pre=[env_js])
Expand Down Expand Up @@ -329,7 +333,7 @@ def publish(dry_run: bool) -> None:
return
context.run(
f"npm --workspace {package.name} publish --access public",
env_dict={"NODE_AUTH_TOKEN": node_auth_token},
env={"NODE_AUTH_TOKEN": node_auth_token},
)

return publish
Expand Down

0 comments on commit fe6b620

Please sign in to comment.