From 75aa1f2389b014aeb88c443891cfc36f895f13b8 Mon Sep 17 00:00:00 2001 From: VictoriaShyika Date: Tue, 23 Apr 2024 14:20:13 +0300 Subject: [PATCH 1/6] package.json updated --- package.json | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 904ccc5..cff07fd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { - "name": "renecss", - "version": "1.3.2", + "name": "@rnbws/renecss", + "version": "0.0.1", "description": "Rene is a design system for intention and meaning", "main": "rene.css", "scripts": { @@ -10,7 +10,13 @@ }, "repository": { "type": "git", - "url": "git+https://github.com/relateapp/rene.git" + "url": "git+https://github.com/rnbwdev/rene.css.git" + }, + "publishConfig": { + "publishConfig": { + "@rnbws:registry": "https://npm.pkg.github.com", + "access": "public" + } }, "keywords": [ "css", @@ -21,9 +27,9 @@ "author": "Relate Design LTD", "license": "MIT", "bugs": { - "url": "https://github.com/relateapp/rene/issues" + "url": "https://github.com/rnbwdev/rene.css/issues" }, - "homepage": "https://github.com/relateapp/rene#readme", + "homepage": "https://github.com/rnbwdev/rene.css#readme", "devDependencies": { "css-loader": "^6.7.1", "css-minimizer-webpack-plugin": "^3.4.1", From a15b5dfe9b3396ec5661add0643fcba57b3d58b1 Mon Sep 17 00:00:00 2001 From: VictoriaShyika Date: Tue, 23 Apr 2024 15:21:45 +0300 Subject: [PATCH 2/6] added workflows --- .github/workflows/publish-npm-package.yml | 32 ++++++++++++++++ .../workflows/release-on-version-change.yml | 38 +++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 .github/workflows/publish-npm-package.yml create mode 100644 .github/workflows/release-on-version-change.yml diff --git a/.github/workflows/publish-npm-package.yml b/.github/workflows/publish-npm-package.yml new file mode 100644 index 0000000..44a3184 --- /dev/null +++ b/.github/workflows/publish-npm-package.yml @@ -0,0 +1,32 @@ +name: Publish NPM Package + +on: + release: + types: [created] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: "20.x" + - run: npm ci + + publish-npm: + needs: build + runs-on: ubuntu-latest + permissions: + packages: write + contents: read + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: "20.x" + registry-url: "https://registry.npmjs.org" + - run: npm ci + - run: npm publish --access public + env: + NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} diff --git a/.github/workflows/release-on-version-change.yml b/.github/workflows/release-on-version-change.yml new file mode 100644 index 0000000..d175fa2 --- /dev/null +++ b/.github/workflows/release-on-version-change.yml @@ -0,0 +1,38 @@ +name: Version Check and Release Creating + +on: + push: + branches: + - main + +jobs: + version-check: + runs-on: ubuntu-latest + outputs: + changed: ${{ steps.version.outputs.changed }} + version: ${{ steps.version.outputs.version }} + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Check for Version Update + id: version + uses: EndBug/version-check@v2.1.4 + with: + file-url: https://unpkg.com/@rnbws/renecss/package.json + static-checking: localIsNew + + create-release: + needs: version-check + if: needs.version-check.outputs.changed == 'true' + runs-on: ubuntu-latest + steps: + - name: Create Tag and GitHub Release + if: needs.version-check.outputs.changed == 'true' + uses: actions/create-release@v1.1.4 + env: + GITHUB_TOKEN: ${{ secrets.ACTIONS_TOKEN }} + with: + tag_name: v${{ needs.version-check.outputs.version }} + release_name: Release v${{ needs.version-check.outputs.version }} From e469581b09b4431ea468a883d88443fbf9eafe2c Mon Sep 17 00:00:00 2001 From: VictoriaShyika Date: Tue, 23 Apr 2024 16:05:08 +0300 Subject: [PATCH 3/6] deleted Publish a new package from contributing.md --- contributing.md | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/contributing.md b/contributing.md index ffa85d4..f081486 100644 --- a/contributing.md +++ b/contributing.md @@ -36,27 +36,7 @@ You’ll find the generated file at `/dist/rene.min.css` ## Publish a new package -Considering you already have an NPM account, with NPM and Node.js installed on your local machine. -1. Open a terminal to login into your NPM account and fill out your username, email and password as requested. - - ``` - npm login - ``` - - > You might also be asked for a one-time-password if there is 2FA applied on your account. - -2. Now, update the version in your `package.json` file. You can use the [SemVer](https://semver.org/) format for versioning. - -3. Ensure there is nothing left to commit and commit any pending work. Then run the below command. - - ``` - npm publish --access public - ``` - -4. Once publishing is completed, `np` will prompt a browser window for adding the release notes to GitHub. Fill in the details. - -That’s all! Your package is published! ## Code of Conduct From 10aef43af3e10a628ba480b4521b3b8b5f4e89cd Mon Sep 17 00:00:00 2001 From: Victoria <92056073+VictoriaShyika@users.noreply.github.com> Date: Tue, 23 Apr 2024 17:10:51 +0300 Subject: [PATCH 4/6] Updated Publish a new package section in contributing.md --- contributing.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/contributing.md b/contributing.md index f081486..a77ba81 100644 --- a/contributing.md +++ b/contributing.md @@ -36,7 +36,20 @@ You’ll find the generated file at `/dist/rene.min.css` ## Publish a new package +To publish a new package version, follow these simple steps: +1. Update `package.json`: Increment the version number in your `package.json` file according to semantic versioning. +2. Commit Changes. +3. Push Changes in `main` branch. +4. GitHub Actions will automatically trigger the workflow to create a release based on the updated version in `package.json` and publish the new package version. +### GitHub Actions Workflow Overview + +The workflow file [release-on-version-change.yml](https://github.com/VictoriaShyika/rene.css/blob/release-and-npm-publish/.github/workflows/release-on-version-change.yml) runs ***Version Check*** and ***Release Creation*** actions. +The workflow file [publish-npm-package.yml](https://github.com/VictoriaShyika/rene.css/blob/release-and-npm-publish/.github/workflows/publish-npm-package.yml) runs ***Publish NPM Package*** action. + +1. ***Version Check***: Checks if the version in the `npm package.json` matches the version in the GitHub repository. +2. ***Release Creation***: Creates a GitHub release when the version in `npm package.json` is different from the version in the GitHub repository. +3. ***Publish NPM Package***: Publishes a new package version when a release is created. ## Code of Conduct From 588a51bb74d6921a29747d5374ac591e2b2c6669 Mon Sep 17 00:00:00 2001 From: Victoria <92056073+VictoriaShyika@users.noreply.github.com> Date: Tue, 23 Apr 2024 17:12:36 +0300 Subject: [PATCH 5/6] Update contributing.md --- contributing.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contributing.md b/contributing.md index a77ba81..2b30e6c 100644 --- a/contributing.md +++ b/contributing.md @@ -44,8 +44,8 @@ To publish a new package version, follow these simple steps: ### GitHub Actions Workflow Overview -The workflow file [release-on-version-change.yml](https://github.com/VictoriaShyika/rene.css/blob/release-and-npm-publish/.github/workflows/release-on-version-change.yml) runs ***Version Check*** and ***Release Creation*** actions. -The workflow file [publish-npm-package.yml](https://github.com/VictoriaShyika/rene.css/blob/release-and-npm-publish/.github/workflows/publish-npm-package.yml) runs ***Publish NPM Package*** action. +The workflow file [`release-on-version-change.yml`](https://github.com/VictoriaShyika/rene.css/blob/release-and-npm-publish/.github/workflows/release-on-version-change.yml) runs ***Version Check*** and ***Release Creation*** actions. +The workflow file [`publish-npm-package.yml`](https://github.com/VictoriaShyika/rene.css/blob/release-and-npm-publish/.github/workflows/publish-npm-package.yml) runs ***Publish NPM Package*** action. 1. ***Version Check***: Checks if the version in the `npm package.json` matches the version in the GitHub repository. 2. ***Release Creation***: Creates a GitHub release when the version in `npm package.json` is different from the version in the GitHub repository. From f4442946067699cd592eb1e2e952024d05736666 Mon Sep 17 00:00:00 2001 From: VictoriaShyika Date: Tue, 23 Apr 2024 18:34:20 +0300 Subject: [PATCH 6/6] fixed package-lock.json --- package-lock.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index f029fd8..d5874d7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { - "name": "renecss", - "version": "1.1.3", + "name": "@rnbws/renecss", + "version": "0.0.1", "lockfileVersion": 2, "requires": true, "packages": { "": { - "name": "renecss", - "version": "1.1.3", + "name": "@rnbws/renecss", + "version": "0.0.1", "license": "MIT", "dependencies": { "np": "^7.6.2"