Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GitHub action to automate release publication #83

Merged
merged 1 commit into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Publish
on:
release:
types: [ published ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '18.x'
registry-url: 'https://registry.npmjs.org'
- run: npm install
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
16 changes: 6 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,12 @@ you need to follow the steps below:
- Update to the new version in [package.json](https://github.com/powsybl/powsybl-diagram-viewer/blob/main/package.json) (example `0.6.0`)
- Update the package-lock.json: `npm install`
- Commit the package.json and package-lock.json files, push to a branch, make a PR, have it reviewed and merged to main.
- Pull and checkout main on your last commit.
- [Tag your last commit](https://semver.org/) : `git tag <tag>` (example: `git tag v0.6.0`)
- Push tag : `git push origin <tag>`
---
- (Optional) Checkout the tag in a fresh repo copy : `cd $(mktemp -d) && git clone https://github.com/powsybl/powsybl-diagram-viewer.git` then `cd powsybl-diagram-viewer && git checkout <tag>`
- (Optional) [Test your package](https://docs.npmjs.com/creating-and-publishing-scoped-public-packages#testing-your-package): `npm install`
---
- Build the package - npm will publish the README.md, the package.json and the dist directory you just generate : `npm run build`
- [Login on the command line to the npm registry](https://docs.npmjs.com/logging-in-to-an-npm-enterprise-registry-from-the-command-line): `npm login`
- [Publish the package](https://docs.npmjs.com/creating-and-publishing-scoped-public-packages#publishing-scoped-public-packages): `npm publish`
- [Make a release](https://github.com/powsybl/powsybl-diagram-viewer/releases/new) on GitHub by creating a new tag on the last commit. On the release creation page:
- In "Choose a tag": type the tag you want to create (ex.: v0.6.0) and select "create new tag"
- In "Target": click on "recent commit" tab and select your release commit
- Click on "Generate release note"
- Click on "Publish release"
- It will trigger a job that will publish the release on NPM

Notes :
* Check [license-checker-config.json](license-checker-config.json) for license white list and exclusion.
Expand Down
Loading