name: 'CI-CD @gear-js/txwrapper' on: pull_request: types: [opened, synchronize, reopened, labeled] branches: [main] paths: - tools/txwrapper/** push: branches: [main] paths: - tools/txwrapper/** workflow_dispatch: jobs: test: if: github.event_name == 'pull_request' runs-on: ubuntu-20.04 steps: - name: Cancel previous workflow runs uses: styfle/cancel-workflow-action@0.4.0 with: access_token: ${{ github.token }} - uses: actions/checkout@v3 - name: "Install: NodeJS 18.x" uses: actions/setup-node@v3 with: node-version: 18.x - name: "Install: pkg dependencies" working-directory: tools/txwrapper run: yarn install - name: "Build: @gear-js/txwrapper" working-directory: tools/txwrapper run: yarn build - name: "Test: run" working-directory: tools/txwrapper run: yarn test publish-to-npm: if: github.event_name == 'push' runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v3 - name: Use node 18.x uses: actions/setup-node@v3 with: node-version: 18.x - name: Check package version uses: EndBug/version-check@v1 id: check with: file-name: tools/txwrapper/package.json file-url: https://unpkg.com/@gear-js/txwrapper@latest/package.json static-checking: localIsNew - name: Install dependencies if: steps.check.outputs.changed == 'true' working-directory: tools/txwrapper run: yarn install - name: Build @gear-js/txwrapper if: steps.check.outputs.changed == 'true' working-directory: tools/txwrapper run: yarn build - name: Publish if: steps.check.outputs.changed == 'true' working-directory: tools/txwrapper run: | export token=$(printenv $(printenv GITHUB_ACTOR)) npm config set //registry.npmjs.org/:_authToken=$token npm publish env: osipov-mit: ${{ secrets.OSIPOV_NPM_TOKEN }}