From efb13c44f05e8fd277aa785c3c4641ff680c2835 Mon Sep 17 00:00:00 2001 From: Lewis Jones Date: Thu, 26 Sep 2024 11:04:52 +0100 Subject: [PATCH 1/3] Publish package to github --- .github/workflows/publish-package.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .github/workflows/publish-package.yml diff --git a/.github/workflows/publish-package.yml b/.github/workflows/publish-package.yml new file mode 100644 index 0000000..c6c178e --- /dev/null +++ b/.github/workflows/publish-package.yml @@ -0,0 +1,23 @@ +name: Publish package to GitHub Packages +on: + release: + types: [published] +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - uses: actions/checkout@v4 + # Setup .npmrc file to publish to GitHub Packages + - uses: actions/setup-node@v4 + with: + node-version: '20.x' + registry-url: 'https://npm.pkg.github.com' + # Defaults to the user or organization that owns the workflow file + scope: '@clearlydefined' + - run: npm ci + - run: npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} From b25598bc92261fdca2085e3d92ed8a85f9fdf422 Mon Sep 17 00:00:00 2001 From: Lewis Jones Date: Thu, 26 Sep 2024 11:19:54 +0100 Subject: [PATCH 2/3] Update readme --- README.md | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index afcabff..f63824f 100644 --- a/README.md +++ b/README.md @@ -6,12 +6,15 @@ This is used by [clearlydefined/service](https://github.com/clearlydefined/servi ## Install +Package is hosted in GitHub packages +See [here](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-npm-registry#installing-packages-from-other-organizations) for details on how to use + ``` -npm install @clearlydefined/spdx +npm install clearlydefined/spdx ``` ```js -const SPDX = require('@clearlydefined/spdx') +const SPDX = require('spdx') SPDX.parse('MIT') SPDX.stringify({ license: 'MIT' }) @@ -33,16 +36,8 @@ npm test ## Release * Merge pull request to this repo (make sure that it updates the version of this package - similar to [this pull request](https://github.com/clearlydefined/spdx/pull/12).) -* Release the new package to npm (the npm login credentials are in the ClearlyDefined Azure keyvault, if you need access or help with this reach out to @nellshamrell) +* Create a relese on the Repository to run the [publish workflow](.github/workflows/publish-package.yml) -``` -cd spdx -git checkout master -git fetch origin -git rebase origin/master -npm login -npm publish -``` -* Update [clearlydefined/service](https://github.com/clearlydefined/service) to use the new version (similar to [this pull request](https://github.com/clearlydefined/service/pull/832)) +* Update [clearlydefined/service](https://github.com/clearlydefined/service) to use the new version From 0b76c9fd855ec549768e2f0d632142de8097bed1 Mon Sep 17 00:00:00 2001 From: Lewis Jones Date: Thu, 26 Sep 2024 11:20:57 +0100 Subject: [PATCH 3/3] Remove comments --- .github/workflows/publish-package.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/publish-package.yml b/.github/workflows/publish-package.yml index c6c178e..2eab3e4 100644 --- a/.github/workflows/publish-package.yml +++ b/.github/workflows/publish-package.yml @@ -10,12 +10,10 @@ jobs: packages: write steps: - uses: actions/checkout@v4 - # Setup .npmrc file to publish to GitHub Packages - uses: actions/setup-node@v4 with: node-version: '20.x' registry-url: 'https://npm.pkg.github.com' - # Defaults to the user or organization that owns the workflow file scope: '@clearlydefined' - run: npm ci - run: npm publish