diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..7655f2f --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,40 @@ +# only trigger on pull request closed events +on: + pull_request: + types: [ closed ] +name: publish package CI + +jobs: + build: + # this job will only run if the PR has been merged + if: github.event.pull_request.merged == true + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Use Node.js 14.x + # Setup .npmrc file to publish to GitHub Packages + uses: actions/setup-node@v2 + with: + node-version: 14.x + registry-url: 'https://npm.pkg.github.com' + # Defaults to the user or organization that owns the workflow file + scope: '@cardinalblue' + + - name: Install Package + run: yarn + env: + NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + # we need to setup user email & name to be able to build the package: https://github.com/fregante/setup-git-user + - name: Setup User + uses: fregante/setup-git-user@v1 + + - name: Build Package + run: yarn build + + - name: Publish Package + run: yarn publish + # https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages#authenticating-to-the-destination-repository + env: + NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.npmrc b/.npmrc index 0d58d39..648a56a 100644 --- a/.npmrc +++ b/.npmrc @@ -1,2 +1,2 @@ @cardinalblue:registry=https://npm.pkg.github.com -//npm.pkg.github.com/:_authToken=${NPM_AUTH_TOKEN} \ No newline at end of file +//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN} \ No newline at end of file diff --git a/package.json b/package.json index 56864a0..c7f8863 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@cardinalblue/cbjs", - "version": "1.4.8", + "version": "1.4.12", "description": "Utilities and common functions and classes for TypeScript, React, RxJS projects", "main": "dist/index.js", "typings": "dist/index.d.ts", @@ -10,7 +10,7 @@ "scripts": { "test": "jest --config jest.config.js", "clean": "rimraf lib dist", - "build": "yarn version --patch && tsc", + "build": "tsc", "p": "yarn publish", "peers": "install-peers" },