Skip to content

Commit fe6b620

Browse files
committed
try to fix npm in gh action
1 parent b153430 commit fe6b620

File tree

4 files changed

+18
-5
lines changed

4 files changed

+18
-5
lines changed

.github/workflows/.hatch-run.yml

+8
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ on:
1717
required: false
1818
type: string
1919
default: '["3.x"]'
20+
uses-secrets:
21+
type: boolean
22+
default: false
2023
secrets:
2124
node-auth-token:
2225
required: false
@@ -36,9 +39,14 @@ jobs:
3639
steps:
3740
- uses: actions/checkout@v2
3841
- uses: actions/setup-node@v2
42+
if: ${{ inputs.uses-secrets }}}
3943
with:
4044
node-version: "14.x"
4145
registry-url: "https://registry.npmjs.org"
46+
- uses: actions/setup-node@v2
47+
if: ${{ inputs.uses-secrets }}}
48+
with:
49+
node-version: "14.x"
4250
- name: Pin NPM Version
4351
run: npm install -g [email protected]
4452
- name: Use Python ${{ matrix.python-version }}

.github/workflows/publish.yml

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ jobs:
1313
with:
1414
job-name: "publish"
1515
hatch-run: "publish"
16+
uses-secrets: true
1617
secrets:
1718
node-auth-token: ${{ secrets.NODE_AUTH_TOKEN }}
1819
pypi-username: ${{ secrets.PYPI_USERNAME }}

src/py/reactpy/pyproject.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[build-system]
2-
requires = ["hatchling", "hatch-build-scripts>=0.0.3"]
2+
requires = ["hatchling", "hatch-build-scripts>=0.0.4"]
33
build-backend = "hatchling.build"
44

55
# --- Project --------------------------------------------------------------------------
@@ -76,7 +76,7 @@ path = "reactpy/__init__.py"
7676

7777
[tool.hatch.envs.default]
7878
features = ["all"]
79-
pre-install-command = "hatch run build --hooks-only"
79+
pre-install-command = "hatch build --hooks-only"
8080
dependencies = [
8181
"coverage[toml]>=6.5",
8282
"pytest",
@@ -125,7 +125,7 @@ all = ["types"]
125125
work_dir = "../../js"
126126
out_dir = "reactpy/_static"
127127
commands = [
128-
"npm install",
128+
"npm ci",
129129
"npm run build"
130130
]
131131
artifacts = [

tasks.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,11 @@ def lint_js(context: Context, fix: bool = False):
125125
@task
126126
def test_py(context: Context, no_cov: bool = False):
127127
"""Run test suites"""
128-
in_py(context, f"hatch run {'test' if no_cov else 'cov'} --maxfail=3")
128+
in_py(
129+
context,
130+
"hatch build --hooks-only",
131+
f"hatch run {'test' if no_cov else 'cov'} --maxfail=3",
132+
)
129133

130134

131135
@task(pre=[env_js])
@@ -329,7 +333,7 @@ def publish(dry_run: bool) -> None:
329333
return
330334
context.run(
331335
f"npm --workspace {package.name} publish --access public",
332-
env_dict={"NODE_AUTH_TOKEN": node_auth_token},
336+
env={"NODE_AUTH_TOKEN": node_auth_token},
333337
)
334338

335339
return publish

0 commit comments

Comments
 (0)