From 02d25cd5d4611791ba5353d74f40d973c30d77ab Mon Sep 17 00:00:00 2001 From: Paul Briand <57703518+P0labrD@users.noreply.github.com> Date: Thu, 24 Aug 2023 17:08:26 +0200 Subject: [PATCH] Chore/npm publish auto (#43) * chore: make packages independent for lerna * chore: create github workflow * fix: remove caching * fix: bump checkout version * fix: add ref branch * chore: add from-package flag * Publish - @bam.tech/eslint-plugin@0.4.1 - @bam.tech/typescript-config@0.3.1 * fix: from-package not a flag * fix: replace NODE_AUTH_TOKEN with NPM_TOKEN * chore: bump eslint-plugin version * chore: up lerna log level * chore: add bootstrap lerna job * fix: add npmrc file writing job * chore: changed event to push tags and branch to main --- .github/workflows/publish.yml | 32 +++++++++++++++++++++++++ .nvmrc | 1 + lerna.json | 2 +- packages/eslint-plugin/package.json | 2 +- packages/typescript-config/package.json | 2 +- 5 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/publish.yml create mode 100644 .nvmrc diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..d4f27a7 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,32 @@ +name: Publish to npm + +on: + push: + tags: + - "*" + +jobs: + publish: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + ref: "main" # Replace with your branch name + + - name: Use Node.js + uses: actions/setup-node@v3 + with: + node-version-file: .nvmrc + + - name: Install dependencies + run: yarn --immutable + + - name: Set up .npmrc file + run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc + + - name: Publish to npm + run: npx lerna publish from-package --no-private --yes + env: + NPM_TOKEN: ${{secrets.NPM_TOKEN}} diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 0000000..25bf17f --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +18 \ No newline at end of file diff --git a/lerna.json b/lerna.json index 37e0ed8..b936b66 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { "$schema": "node_modules/lerna/schemas/lerna-schema.json", "useWorkspaces": true, - "version": "0.2.0" + "version": "independent" } diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index c90dfd0..c9151cf 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@bam.tech/eslint-plugin", - "version": "0.4.0", + "version": "0.4.2", "description": "eslint plugin for bam projects", "keywords": [ "eslint", diff --git a/packages/typescript-config/package.json b/packages/typescript-config/package.json index f00d7e2..00e6232 100644 --- a/packages/typescript-config/package.json +++ b/packages/typescript-config/package.json @@ -1,6 +1,6 @@ { "name": "@bam.tech/typescript-config", - "version": "0.3.0", + "version": "0.3.1", "license": "MIT", "peerDependencies": { "expo": ">=47"