agiledigital / jiralint

A library and supporting CLI tool for linting deliveries, issues and people as they manifest in Jira.
7 stars 3 forks source link

Publish lib package to GPR automatically #25

Closed danielnixon closed 3 years ago

danielnixon commented 3 years ago

Now that jiralint-pulumi is consuming the lib package from this repo via a true npm package (private; Github Package Registry), it would be good to automatically publish that package upon release of this repo (via github action, probably).

This will probably involve:

  1. in the CI github action: publish the npm package. The ambient GITHUB_TOKEN should give you permission to do this. The action at https://github.com/cycjimmy/semantic-release-action looks promising for this. If that action doesn't work, fall back on doingnpm publish manually (https://docs.npmjs.com/cli/v6/commands/npm-publish). Ensure you're publishing to the private Github Package Registry associated with this repo, not the public npm registry
  2. do the above step only for main branch and/or only for release tags

If that doesn't work, we may have to use a machine user and a corresponding PAT:

  1. provision a machine user (https://docs.github.com/en/developers/overview/managing-deploy-keys)
  2. crete a PAT for that machine user that is permitted to publish packages (https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token)
  3. store that PAT in a github secret for this repo (https://github.com/agiledigital-labs/jiralint/settings/secrets/actions)
  4. in the CI github action: move that PAT where it needs to be so npm publish uses it (cf. https://github.com/agiledigital-labs/jiralint-pulumi/blob/main/.github/workflows/build-test.yml#L28)
  5. then as above