-
Notifications
You must be signed in to change notification settings - Fork 0
Add publish step #33
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
base: main
Are you sure you want to change the base?
Add publish step #33
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,13 +12,13 @@ jobs: | |
|
|
||
| steps: | ||
| - name: Checkout 🛎️ | ||
| uses: actions/checkout@master | ||
| uses: actions/checkout@v3 | ||
|
|
||
| - name: Setup Node 🔧 | ||
| uses: actions/setup-node@v3 | ||
| with: | ||
| node-version: '14' | ||
|
|
||
| - name: Install and Build 🔧 | ||
| run: | | ||
| yarn install | ||
|
|
@@ -30,3 +30,16 @@ jobs: | |
| with: | ||
| branch: gh-pages # The branch the action should deploy to. It should be any branch other than `main` | ||
| folder: dist # The folder the action should deploy. | ||
|
|
||
| - name: Publish ✨ | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know very little about github actions, but this is a 'step' within the 'build' job. Is it better practice to have a 'build' job and a 'publish' job? (That would be closer to our CircleCI setup for other repos)
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's a good question! I don't know the best practices here, so you tell me.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. From some quick Googling, folks advocate for "keeping jobs simple," but there doesn't seem to be a ton of best-practices out there. I'm curious if it would get rid of the need to repeat steps if you made Publish a separate job, but used the If so, that feels cleaner to me.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I like it |
||
| id: publish | ||
| if: github.ref == 'refs/heads/main' | ||
| uses: JS-DevTools/npm-publish@v1 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this a github-developed action or third party? If not github, could you link to it? (Want to verify that it's well-maintained, popular, etc.)
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| with: | ||
| token: ${{ secrets.NPM_TOKEN }} | ||
| check-version: true | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what does 'check-version' do?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Only publish to NPM if the version number in package.json differs from the latest on NPM
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should we also use |
||
|
|
||
| - name: Version update | ||
| if: steps.publish.outputs.type != 'none' | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this just to make sure there wasn't an error? (Is it possible that the Publish step could fail but still output something?) (I'm not very familiar with GH actions, so if there's a reference talking about best practices for this stuff, I'd love to see it!)
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I mostly copied it from an example action.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I read the docs and now I get it! |
||
| run: | | ||
| echo "Version changed: ${{ steps.publish.outputs.old-version }} => ${{ steps.publish.outputs.version }}" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. how does
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It uses the version we specify in
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perfect. |
||

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we know if there was a reason we were pointing at the development branch before / was there a reason you needed to make this change?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know honestly. It just felt right to point at a specific version, so that things don't break suddenly