Skip to content

Commit b1cf4be

Browse files
authored
Merge pull request #32 from clearlydefined/publish-package-to-github
Publish package to github
2 parents 0007a37 + 0b76c9f commit b1cf4be

File tree

2 files changed

+28
-12
lines changed

2 files changed

+28
-12
lines changed

.github/workflows/publish-package.yml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Publish package to GitHub Packages
2+
on:
3+
release:
4+
types: [published]
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
permissions:
9+
contents: read
10+
packages: write
11+
steps:
12+
- uses: actions/checkout@v4
13+
- uses: actions/setup-node@v4
14+
with:
15+
node-version: '20.x'
16+
registry-url: 'https://npm.pkg.github.com'
17+
scope: '@clearlydefined'
18+
- run: npm ci
19+
- run: npm publish
20+
env:
21+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

README.md

+7-12
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,15 @@ This is used by [clearlydefined/service](https://github.com/clearlydefined/servi
66

77
## Install
88

9+
Package is hosted in GitHub packages
10+
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
11+
912
```
10-
npm install @clearlydefined/spdx
13+
npm install clearlydefined/spdx
1114
```
1215

1316
```js
14-
const SPDX = require('@clearlydefined/spdx')
17+
const SPDX = require('spdx')
1518

1619
SPDX.parse('MIT')
1720
SPDX.stringify({ license: 'MIT' })
@@ -33,16 +36,8 @@ npm test
3336

3437
## Release
3538
* 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).)
36-
* 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)
39+
* Create a relese on the Repository to run the [publish workflow](.github/workflows/publish-package.yml)
3740

38-
```
39-
cd spdx
40-
git checkout master
41-
git fetch origin
42-
git rebase origin/master
43-
npm login
44-
npm publish
45-
```
4641

47-
* 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))
42+
* Update [clearlydefined/service](https://github.com/clearlydefined/service) to use the new version
4843

0 commit comments

Comments
 (0)