From 5ff8bd72bbae29d64706ff6998c63df949ae22a1 Mon Sep 17 00:00:00 2001 From: lichin-lin Date: Tue, 9 Nov 2021 13:18:50 +0800 Subject: [PATCH 1/8] feat: add build script --- .github/workflows/publish.yml | 23 +++++++++++++++++++++++ package.json | 2 +- 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..b3dbecc --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,23 @@ +name: publish package CI + +jobs: + build: + runs-on: ubuntu-18.04 + steps: + - name: Git branch name + id: git-branch-name + uses: EthanSK/git-branch-name-action@v1 + + - name: Echo the branch name + run: echo "Branch name ${GIT_BRANCH_NAME}" + + - uses: actions/checkout@v2 + + - name: Use Node.js 14.x + uses: actions/setup-node@v1 + with: + node-version: 14.x + + - run: npm ci + - run: npm run lint + - run: npm test diff --git a/package.json b/package.json index 56864a0..6e7d227 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@cardinalblue/cbjs", - "version": "1.4.8", + "version": "1.4.9-f-setup-auto-packaging", "description": "Utilities and common functions and classes for TypeScript, React, RxJS projects", "main": "dist/index.js", "typings": "dist/index.d.ts", From 3d52a71cfc0a85f9e3c10b1ce68858db8d071f77 Mon Sep 17 00:00:00 2001 From: lichin-lin Date: Tue, 9 Nov 2021 13:20:59 +0800 Subject: [PATCH 2/8] feat: add build script --- .github/workflows/publish.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index b3dbecc..53de277 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,3 +1,4 @@ +on: [pull_request] name: publish package CI jobs: @@ -17,7 +18,4 @@ jobs: uses: actions/setup-node@v1 with: node-version: 14.x - - - run: npm ci - - run: npm run lint - - run: npm test + - run: npm build From 0dc4ee548c44dc692cc702f9168293edf1d80ccf Mon Sep 17 00:00:00 2001 From: lichin-lin Date: Tue, 9 Nov 2021 13:30:56 +0800 Subject: [PATCH 3/8] feat: add build script --- .github/workflows/publish.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 53de277..c92ef84 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -18,4 +18,8 @@ jobs: uses: actions/setup-node@v1 with: node-version: 14.x - - run: npm build + - run: yarn + env: + NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} + - run: yarn build + From 6d272184425b3521363b6cfb51ab65c5c4aaeaa0 Mon Sep 17 00:00:00 2001 From: lichin-lin Date: Wed, 10 Nov 2021 12:04:38 +0800 Subject: [PATCH 4/8] feat: add build script --- .github/workflows/publish.yml | 17 ++++++++++++++--- package.json | 2 +- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index c92ef84..57d419f 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -20,6 +20,17 @@ jobs: node-version: 14.x - run: yarn env: - NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} - - run: yarn build - + 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/package.json b/package.json index 6e7d227..9228bd4 100644 --- a/package.json +++ b/package.json @@ -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" }, From 116d87d9071c6d779ab60a53d68274b9d2d43e8d Mon Sep 17 00:00:00 2001 From: lichin-lin Date: Wed, 10 Nov 2021 12:18:28 +0800 Subject: [PATCH 5/8] feat: update gitflow --- .github/workflows/publish.yml | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 57d419f..0922530 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -3,22 +3,21 @@ name: publish package CI jobs: build: - runs-on: ubuntu-18.04 + runs-on: ubuntu-latest steps: - - name: Git branch name - id: git-branch-name - uses: EthanSK/git-branch-name-action@v1 - - - name: Echo the branch name - run: echo "Branch name ${GIT_BRANCH_NAME}" - - uses: actions/checkout@v2 - name: Use Node.js 14.x - uses: actions/setup-node@v1 + # Setup .npmrc file to publish to GitHub Packages + uses: actions/setup-node@v2 with: node-version: 14.x - - run: yarn + 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 }} From 4f3b69eca7a54933be866a2b4eab135441ac3b77 Mon Sep 17 00:00:00 2001 From: lichin-lin Date: Wed, 10 Nov 2021 12:19:51 +0800 Subject: [PATCH 6/8] feat: update gitflow --- .github/workflows/publish.yml | 7 ++++++- .npmrc | 2 +- package.json | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 0922530..7655f2f 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,8 +1,13 @@ -on: [pull_request] +# 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 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 9228bd4..cea18d5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@cardinalblue/cbjs", - "version": "1.4.9-f-setup-auto-packaging", + "version": "1.4.10", "description": "Utilities and common functions and classes for TypeScript, React, RxJS projects", "main": "dist/index.js", "typings": "dist/index.d.ts", From f05da6d0a8ac3beb25901f349a88ba78cda2519b Mon Sep 17 00:00:00 2001 From: lichin-lin Date: Thu, 11 Nov 2021 12:26:28 +0800 Subject: [PATCH 7/8] feat: bump version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index cea18d5..37655c6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@cardinalblue/cbjs", - "version": "1.4.10", + "version": "1.4.11", "description": "Utilities and common functions and classes for TypeScript, React, RxJS projects", "main": "dist/index.js", "typings": "dist/index.d.ts", From be0baafb4cd201ce08092bfc4c50d8bd9a58e24a Mon Sep 17 00:00:00 2001 From: lichin-lin Date: Thu, 11 Nov 2021 13:14:05 +0800 Subject: [PATCH 8/8] feat: bump version to 1.4.12 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 37655c6..c7f8863 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@cardinalblue/cbjs", - "version": "1.4.11", + "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",