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

Create NPM package #102

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
34 changes: 20 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,28 @@ on: [push, pull_request]

jobs:
main:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04]
runs-on: ubuntu-latest
permissions:
id-token: write
env:
RSPM: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"
_R_CHECK_CRAN_INCOMING_REMOTE_: false

steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.9'
python-version: '3.13'
- uses: actions/setup-dotnet@v1
with:
dotnet-version: '6.0.x'
- uses: r-lib/actions/setup-r@v1
- uses: r-lib/actions/setup-r@v2
with:
r-version: '4'
- uses: r-lib/actions/setup-pandoc@v1
- uses: actions/setup-node@v2
- uses: r-lib/actions/setup-pandoc@v2
- uses: actions/setup-node@v4
with:
node-version: '16'
node-version: 20

- name: Install python dependecies
run: pip install cffi numba pytest
Expand All @@ -43,7 +42,7 @@ jobs:
working-directory: ./src/r
shell: Rscript {0}
- name: Cache R packages
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-${{ hashFiles('src/r/.github/R-version') }}-1-${{ hashFiles('src/r/.github/depends.Rds') }}
Expand Down Expand Up @@ -77,11 +76,18 @@ jobs:
- name: Run tests (R)
run: cd $GITHUB_WORKSPACE/src/r && R CMD build . && R CMD check --no-manual --as-cran psychrolib*tar.gz

- name: Publish NPM package
run: |
cd src/js
npm publish --provenance --access public || echo 'This version is already published. Skipping this step!'
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

gh-pages:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.8

Expand Down
36 changes: 36 additions & 0 deletions src/js/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"name": "psychrolib",
"version": "1.0.0",
"main": "psychrolib.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"javascript",
"python",
"c",
"engineering",
"csharp",
"fortran",
"excel",
"temperature",
"meteorology",
"vba",
"pressure",
"net",
"humidity",
"hvac",
"thermodynamic-properties",
"psychrometrics",
"relative-humidity",
"ashrae",
"moist-air",
"dew-point-temperature"
],
"author": "https://github.com/psychrometrics",
"license": "MIT",
"description": "📚 Library of psychrometric functions to calculate 🌡️ thermodynamic properties of air for Python, C, C#, Fortran, R, JavaScript and VBA/Excel",
"repository": {
"url": "https://github.com/psychrometrics/psychrolib"
}
}
Loading