Merge pull request #245 from IntersectMBO/paolino #485
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: TypeScript NPM Package | |
on: | |
pull_request: | |
push: | |
branches: [ "master" ] | |
tags: [ "*.*.*" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: jsapi | |
env: | |
NODE_OPTIONS: "--max-old-space-size=32768" | |
steps: | |
- name: '📥 Checkout Code' | |
uses: actions/checkout@v2.3.4 | |
- uses: cachix/install-nix-action@v13 | |
with: | |
github_access_token: ${{ secrets.GITHUB_TOKEN }} | |
extra_nix_config: | | |
trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= | |
substituters = https://cache.iog.io https://cache.nixos.org/ | |
- name: 'Install dependencies' | |
run: 'nix-shell --run "npm install"' | |
- name: 'Build' | |
run: 'nix-shell --run "npm run build"' | |
- name: 'Test' | |
run: 'nix-shell --run "npm run test"' | |
- name: 'Typedoc' | |
run: | | |
du -cBM --max-depth=1 /opt 2> >(grep -v 'Permission denied') | sort -n | |
du -cBM --max-depth=1 /nix 2> >(grep -v 'Permission denied') | sort -n | |
du -cBM --max-depth=1 /usr 2> >(grep -v 'Permission denied') | sort -n | |
nix-shell --run "npm run typedoc" | |
- name: 'Demo' | |
run: 'nix-build -A demo -o result-demo' | |
- name: 'Prepare Documentation' | |
run: | | |
mkdir ../_build | |
mv _docs ../_build/typescript | |
cp -R --no-preserve=all ./result-demo/share/doc/cardano-addresses-demo-js ../_build/demo | |
- name: '📤 Publish Documentation' | |
if: ${{ startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/master' }} | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: _build | |
enable_jekyll: true | |
keep_files: true | |
user_name: 'William King Noel Bot' | |
user_email: 'adrestia@iohk.io' | |
- name: 'npm publish' | |
if: ${{ startsWith(github.ref, 'refs/tags/') }} | |
run: | | |
tag="${GITHUB_REF/refs\/tags\//}" | |
package_version="$(jq -r .version package.json)" | |
echo "tag=$tag\npackage_version=$package_version" | |
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc | |
nix-shell --run "npm publish" | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |