name: Npm
on:
  workflow_dispatch:
    inputs:
      version:
        description: 'NPM exact version'
        required: true
  schedule:
    - cron:  '0 0 * * *'

jobs:
  build:

    runs-on: ubuntu-latest

    strategy:
      matrix:
        node-version: [14, 15, 16]
    
    steps:
      - name: Use Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v2
        with:
          node-version: ${{ matrix.node-version }}
          check-latest: true
      - name: Update NPM to latest
        run: npm --version;npm install -g npm;npm --version
      - name: Install React Native CLI
        run: npm install -g @react-native-community/cli
      - name: Init new project
        run: react-native init --npm test; cd test
      - name: "Install version ${{ github.event.inputs.version }}"
        run: "npm install react-native-render-html@${{ github.event.inputs.version }}"