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

Replace release workflow and add node token as input #112

Merged
merged 5 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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: 0 additions & 18 deletions .github/workflows/publish.yml

This file was deleted.

56 changes: 56 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Release

on:
workflow_dispatch:
inputs:
versionType:
description: version type increment (major | minor | patch)
required: true
nodeAuthToken:
required: true
type: string
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Mask Node Auth Token
- run: |
NODE_AUTH_TOKEN=$(jq -r '.inputs.nodeAuthToken' $GITHUB_EVENT_PATH)
echo ::add-mask::$NODE_AUTH_TOKEN
echo NODE_AUTH_TOKEN=$NODE_AUTH_TOKEN >> $GITHUB_ENV

- uses: actions/create-github-app-token@v1
id: app-token
name: Generate app token
with:
app-id: ${{ vars.POWSYBL_ACTIONS_APPID }}
private-key: ${{ secrets.POWSYBL_ACTIONS_SECRET }}

- name: Checkout sources
uses: actions/checkout@v4
with:
fetch-depth: 0
antoinebhs marked this conversation as resolved.
Show resolved Hide resolved
token: ${{ steps.app-token.outputs.token }}

- uses: actions/setup-node@v4
with:
node-version: '18.x'
registry-url: 'https://registry.npmjs.org'

- name: Add release commit and publish
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
npm version ${{ github.event.inputs.versionType }}
git push origin main
git push origin $(git tag --points-at HEAD)
npm install
npm publish
env:
NODE_AUTH_TOKEN: ${{ env.NODE_AUTH_TOKEN }}

- name: Create GitHub release
run: |
gh release create $(git tag --points-at HEAD) --generate-notes
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
14 changes: 5 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,11 @@ To fix this, run this command from the app **after** running "npm install"
If you want to deploy a new version of powsybl-diagram-viewer in the [NPM package registry](https://www.npmjs.com/package/@powsybl/powsybl-diagram-viewer),
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.
- [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
- [Make a release action](https://github.com/powsybl/powsybl-diagram-viewer/actions/workflows/release.yml)
- In the 'run workflow' combobox select, let the branch on main
- Enter the type of evolution (major | minor | patch)
- Enter your NPM access token (see [access token documentation](https://docs.npmjs.com/creating-and-viewing-access-tokens) for details)
- Click 'run workflow'

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