Skip to content

Commit

Permalink
Add GitHub action to automate release (#83)
Browse files Browse the repository at this point in the history
Signed-off-by: BOUHOURS Antoine <antoine.bouhours@rte-france.com>
  • Loading branch information
antoinebhs authored Jul 3, 2024
1 parent a8c7e13 commit 4a3231e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 10 deletions.
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

0 comments on commit 4a3231e

Please sign in to comment.