From 1b4dbd9f0a0f2d36b9f28fb7b9b8740b384f7224 Mon Sep 17 00:00:00 2001 From: John Dunn Date: Thu, 23 May 2024 22:07:35 -0700 Subject: [PATCH 1/4] initial github workflow to publish npm package --- .github/workflows/npmPublish.yml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/npmPublish.yml diff --git a/.github/workflows/npmPublish.yml b/.github/workflows/npmPublish.yml new file mode 100644 index 0000000..2571476 --- /dev/null +++ b/.github/workflows/npmPublish.yml @@ -0,0 +1,31 @@ +name: Publish npm Package + +on: + push: + branches: + - main + +jobs: + publish-react: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Install dependencies + run: cd package-react + npm install + + - name: Build package + run: npm run build # If you have a build step, otherwise remove this step + + - name: Publish package + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + run: npm publish From 30bb8e759b9585ca371fb2512a1c355d5cb27ac7 Mon Sep 17 00:00:00 2001 From: John Dunn Date: Thu, 23 May 2024 22:58:29 -0700 Subject: [PATCH 2/4] added svelte and vue to npm workflow --- .github/workflows/npmPublish.yml | 65 ++++++++++++++++++++++++++++---- 1 file changed, 58 insertions(+), 7 deletions(-) diff --git a/.github/workflows/npmPublish.yml b/.github/workflows/npmPublish.yml index 2571476..2221245 100644 --- a/.github/workflows/npmPublish.yml +++ b/.github/workflows/npmPublish.yml @@ -1,4 +1,4 @@ -name: Publish npm Package +name: Publish npm Packages on: push: @@ -8,7 +8,56 @@ on: jobs: publish-react: runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' # Use Node.js version 20 + + - name: Install dependencies for package-react + working-directory: ./package-react + run: npm install + - name: Build package-react + working-directory: ./package-react + run: npm run build # If you have a build step, otherwise remove this step + + - name: Publish package-react + working-directory: ./package-react + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + run: npm publish + + publish-svelte: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' # Use Node.js version 20 + + - name: Install dependencies for package-svelte + working-directory: ./package-svelte + run: npm install + + - name: Build package-svelte + working-directory: ./package-svelte + run: npm run build # If you have a build step, otherwise remove this step + + - name: Publish package-svelte + working-directory: ./package-svelte + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + run: npm publish + + publish-vue: + runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v4 @@ -16,16 +65,18 @@ jobs: - name: Set up Node.js uses: actions/setup-node@v4 with: - node-version: '20' + node-version: '20' # Use Node.js version 20 - - name: Install dependencies - run: cd package-react - npm install + - name: Install dependencies for package-vue + working-directory: ./package-vue + run: npm install - - name: Build package + - name: Build package-vue + working-directory: ./package-vue run: npm run build # If you have a build step, otherwise remove this step - - name: Publish package + - name: Publish package-vue + working-directory: ./package-vue env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} run: npm publish From 7e5ca9d1fd058451069d9695d5167e32f1b73c39 Mon Sep 17 00:00:00 2001 From: John Dunn Date: Thu, 23 May 2024 23:12:00 -0700 Subject: [PATCH 3/4] added notes --- .github/workflows/npmPublish.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/npmPublish.yml b/.github/workflows/npmPublish.yml index 2221245..a680e6b 100644 --- a/.github/workflows/npmPublish.yml +++ b/.github/workflows/npmPublish.yml @@ -5,6 +5,11 @@ on: branches: - main +# These currently require that the package version has been manually updated +# We could potentially automate it by creating a separate script that fetches the current version on npm and compares it the the version in the package.json. If it matches, it auto-increments the number in package.json (ie from 2.1.11 to 2.1.12). And we run this script before the publish step. +# Simpler solution is to use npm version command that can be used to increment the version number (npm version patch, npm version minor, npm version major) where format is major.minor.patch +# Any version incrementing should probably happen on pushes to dev so that dev and main branch stay in sync. We can simply always increment the patch version +# Think we can update github settings to ensure you merges fail if an action fails, but that means each merge updates all 3 packages jobs: publish-react: runs-on: ubuntu-latest From 8fa868aaa09c88ee74171953cacea09cf15dd3b2 Mon Sep 17 00:00:00 2001 From: John Dunn Date: Thu, 23 May 2024 23:12:28 -0700 Subject: [PATCH 4/4] bumped version in package react --- package-react/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package-react/package.json b/package-react/package.json index ae7efd8..e73f201 100644 --- a/package-react/package.json +++ b/package-react/package.json @@ -18,7 +18,7 @@ "type": "git", "url": "https://github.com/oslabs-beta/react-query-rewind" }, - "version": "2.1.0", + "version": "2.1.1", "description": "React Query Rewind is a library that helps developers debug applications that use React Query (ie TanStack Query) by letting them time travel through state changes directly in their chrome dev tools", "keywords": [ "react",