CIP-0129 support #692
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/[email protected] | |
- name: Install nix | |
uses: cachix/install-nix-action@v27 | |
with: | |
github_access_token: ${{ secrets.GITHUB_TOKEN }} | |
extra_nix_config: | | |
experimental-features = nix-command flakes | |
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 develop ..#cardano-addresses-js-shell --command npm install' | |
- name: 'Build' | |
run: 'nix develop ..#cardano-addresses-js-shell --command npm run build' | |
- name: 'Test' | |
run: 'nix develop ..#cardano-addresses-js-shell --command 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 develop ..#cardano-addresses-js-shell --command npm run typedoc | |
- name: 'Demo' | |
run: | | |
git add -f dist | |
nix build ..#cardano-addresses-demo-js -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: '[email protected]' | |
- 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 develop ..#cardano-addresses-js-shell --command npm publish | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |