diff --git a/.github/workflows/publish-to-npm.workflow.yml b/.github/workflows/publish-to-npm.workflow.yml new file mode 100644 index 00000000..478126f3 --- /dev/null +++ b/.github/workflows/publish-to-npm.workflow.yml @@ -0,0 +1,53 @@ +name: Publish to NPM + +on: + workflow_dispatch: + inputs: + version: + description: The version string passed to "npm version". Either `patch`, `minor`, `major` or a semver like `1.2.3` + required: true + type: string + +permissions: + contents: write + +concurrency: + cancel-in-progress: true + group: publish-${{ github.ref }} + +jobs: + publish_to_npm: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + token: ${{ secrets.PAT }} + - uses: actions/setup-node@v2 + with: + node-version: 16.x + registry-url: "https://registry.npmjs.org" + cache: npm + + - name: Configure git + run: | + git config --local user.name 'github-action[bot]' + git config --local user.email 'github-action[bot]@github.com' + + - run: npm ci --audit=false + - run: npm run build + + - run: npm version ${{ inputs.version }} + + - name: Push to git + run: | + git push + git push --tags + + - name: Create release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: gh release create "v$(npm -s run env echo '$npm_package_version')" + + - run: npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.npmignore b/.npmignore index e2c3e233..5ae8ecde 100644 --- a/.npmignore +++ b/.npmignore @@ -13,9 +13,11 @@ gqlschema.gql **/*.spec.js **/*.js.map -.eslinrc.js +.eslintrc.js .prettierrc nest-cli.json tsconfig.tsbuildinfo +tsconfig.json +tsconfig.build.json .dependency-cruiser.js dependency-graph.html \ No newline at end of file diff --git a/.npmrc b/.npmrc new file mode 100644 index 00000000..6d6e1594 --- /dev/null +++ b/.npmrc @@ -0,0 +1,2 @@ +# Add [no ci] to version commits so it does not trigger pipelines +message="%s [no ci]" \ No newline at end of file