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

Configure Publishing OSCAL Viewer to GitHub Packages #168

Merged
merged 6 commits into from
Oct 1, 2021
Merged

Conversation

hreineck
Copy link
Contributor

@hreineck hreineck commented Sep 24, 2021

Set up package.json and GitHub actions to publish to GitHub packages.

Made changes to example/package.json to configure npm publish to
push to GitHub packages.

Created a GitHub actions script to publish on a push to develop.
Changed the permissions in the GitHub actions for security.
@hreineck
Copy link
Contributor Author

This and the corresponding PR in oscal-rest-service handle setting up GitHub packages as part of the all-in-one deployment.
Once the changes to package.json are made, the package can be published by simply running npm publish with necessary credentials - but I figured a formalized GitHub actions would be better and more reviewable.

@@ -2,7 +2,10 @@
"name": "oscal-viewer",
"homepage": ".",
"version": "0.1.0",
"private": true,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about this change. I thought it needed to be removed in order to publish - can someone clarify what this line was doing or if it's still necessary?

Copy link
Contributor

@kylelaker kylelaker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a few questions here since we're talking about the example application (not library). I think all of this would be absolutely phenomenal for the React Library at the root but we may want to think about the design a bit for the example app.

  1. Is it really appropriate to deploy the example app to GitHub Packages? It's more of a static asset after an npm run build and we can just deploy the examples/build folder directly. Do we really care about the full contents of the NPM package and do those provide us any benefit anyway? Perhaps we'd be better served by actions/upload-artifact rather than by publishing. Will it provide any benefit inside a node_modules/ folder? I believe we're actually already pushing that as an artifact: https://github.com/EasyDynamics/oscal-react-library/actions/runs/1174249533.
  2. If we're going to go to this effort to publish the example app, should we configure the library to be published to GitHub Packages while we're setting this workflow up? We can always switch to a "real"/default registry like NPM's later but this would let us have a place to pull down snapshot versions of the library.

example/package.json Outdated Show resolved Hide resolved
Removed unnecessary permissions on gh-pages.yml and added the proper
permissions to gh-packages.yml
@hreineck
Copy link
Contributor Author

I have a few questions here since we're talking about the example application (not library). I think all of this would be absolutely phenomenal for the React Library at the root but we may want to think about the design a bit for the example app.

  1. Is it really appropriate to deploy the example app to GitHub Packages? It's more of a static asset after an npm run build and we can just deploy the examples/build folder directly. Do we really care about the full contents of the NPM package and do those provide us any benefit anyway? Perhaps we'd be better served by actions/upload-artifact rather than by publishing. Will it provide any benefit inside a node_modules/ folder? I believe we're actually already pushing that as an artifact: https://github.com/EasyDynamics/oscal-react-library/actions/runs/1174249533.

We don't really care about anything but the static output of build, but GitHub Packages may still be a good option since we will eventually be setting up a pipeline to deploy the library to a registry anyway.
If there's nothing explicitly wrong with publishing the entire app, I think it may be simpler to keep using the current approach;
the upload-artifacts action seems to be geared more towards sharing artifacts within a single worklow. I could only find this third-party action: https://github.com/dawidd6/action-download-artifact to be able to download from one repo to another.
Would like to know what the team thinks of this - if the approach using artifacts seems better we can certainly use that instead.

  1. If we're going to go to this effort to publish the example app, should we configure the library to be published to GitHub Packages while we're setting this workflow up? We can always switch to a "real"/default registry like NPM's later but this would let us have a place to pull down snapshot versions of the library.

Good call.

hreineck and others added 3 commits September 28, 2021 13:25
Update the Setup Node step in the gh-packages Actions file to cache package dependencies.

Co-authored-by: Kyle Laker <klaker@easydynamics.com>
Change the protocol from git:// to https:// in the "repository" field for setting up publishing to the GitHub npm registry.
Add a `directory` pointing to the example directory.

Co-authored-by: Kyle Laker <klaker@easydynamics.com>
Updated the GitHub actions config and root package.json to
configure publishing the React Library to GitHub packages
along with the Viewer.
This will continously publish the React Library and set things up
to eventually publish to a public registry.
Copy link
Contributor

@mikeisen1 mikeisen1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything looks good to go. Nice work!

@mikeisen1 mikeisen1 linked an issue Oct 1, 2021 that may be closed by this pull request
@kylelaker kylelaker merged commit 0754dff into develop Oct 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Configure Publishing OSCAL Viewer to GitHub Packages
3 participants