name: 'Generate index.html'

on: workflow_dispatch

jobs:
  build-publish:
    environment: NPM_TOKEN_NIK
    runs-on: ubuntu-latest

    steps:
      - name: checking repository out
        uses: actions/checkout@v2
        with:
          ref: ${{ github.ref }}
          path: .

      - name: Use Node.js '16.x'
        uses: actions/setup-node@v3
        with:
          node-version: '16.x'
          registry-url: 'https://registry.npmjs.org'
      
      - name: installing npm dependencies
        run: npm install
      
      - name: install inliner
        run: npm install inliner -g
      
      - name: Build phone app and inline index.html
        run: |
          CI=false npm run build
          node move-script-tag.js
          script --return --quiet --command "npx inliner build/index.html > index-inline.html"
      

      - name: delete me
        run: ls -la . && ls -la build && cat build/index.html && cat index-inline.html

      # - name: inline index.html
      #   run: npx inliner -v build/index.html > index-inline.html

      - name: upload index.html
        uses: actions/upload-artifact@v2
        with:
          name: index.html
          path: index-inline.html
