name: 'CI-CD @gear-js/gear-meta' on: pull_request: branches: [main] paths: - utils/meta-cli/** push: branches: [main] paths: - utils/meta-cli/** jobs: test: if: github.event_name == 'pull_request' runs-on: ubuntu-latest steps: - name: Cancel previous workflow runs uses: styfle/cancel-workflow-action@0.4.0 with: access_token: ${{ github.token }} - uses: actions/checkout@v2 - name: Install NodeJS 16.x uses: actions/setup-node@v2.1.5 with: node-version: 16.x - name: Prepare run: | mkdir utils/meta-cli/test/wasm wget -O utils/meta-cli/test/wasm/examples.tar.gz https://github.com/gear-tech/gear/releases/download/build/examples.tar.gz - name: Install dependencies working-directory: utils/meta-cli run: yarn install - name: Run tests working-directory: utils/meta-cli run: | cd test/wasm tar -xvf examples.tar.gz cd ../.. yarn test publish-to-npm: if: github.event_name == 'push' runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: Use node 16.x uses: actions/setup-node@v2.1.5 with: node-version: 16.x - name: Check package version uses: EndBug/version-check@v1 id: check with: file-name: utils/meta-cli/package.json file-url: https://unpkg.com/@gear-js/gear-meta@latest/package.json static-checking: localIsNew - name: Publish if: steps.check.outputs.changed == 'true' working-directory: utils/meta-cli run: | export token=$(printenv $(printenv GITHUB_ACTOR)) npm config set //registry.npmjs.org/:_authToken=$token npm publish env: osipov-mit: ${{ secrets.OSIPOV_NPM_TOKEN }}