-
-
Notifications
You must be signed in to change notification settings - Fork 944
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
ci: publish workflow #2591
ci: publish workflow #2591
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## next #2591 +/- ##
=======================================
Coverage 99.96% 99.96%
=======================================
Files 2989 2989
Lines 216081 216081
Branches 953 951 -2
=======================================
Hits 216008 216008
Misses 73 73 |
64d478b
to
8ed6b41
Compare
✅ Deploy Preview for fakerjs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
b6ef4c9
to
c8e84b2
Compare
c8e84b2
to
64618fd
Compare
Co-authored-by: ST-DDT <ST-DDT@gmx.de>
PACKAGE_DIST_TAG=$(node -e "console.log(/^\d+\.\d+\.\d+(\-(\w+)\.\d+)$/.exec(require('./package.json').version)?.[2] || 'latest')") | ||
pnpm publish --access public --tag $PACKAGE_DIST_TAG | ||
|
||
- name: Set next dist-tag | ||
run: | | ||
PACKAGE_VERSION=$(node -e "console.log(require('./package.json').version)") | ||
pnpm dist-tag add @faker-js/faker@$PACKAGE_VERSION next |
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.
IMO we should tag it with next by default and set the latest only when it is a stable release:
PACKAGE_DIST_TAG=$(node -e "console.log(/^\d+\.\d+\.\d+(\-(\w+)\.\d+)$/.exec(require('./package.json').version)?.[2] || 'latest')") | |
pnpm publish --access public --tag $PACKAGE_DIST_TAG | |
- name: Set next dist-tag | |
run: | | |
PACKAGE_VERSION=$(node -e "console.log(require('./package.json').version)") | |
pnpm dist-tag add @faker-js/faker@$PACKAGE_VERSION next | |
PACKAGE_VERSION=$(node -e "console.log(require('./package.json').version)") | |
pnpm publish --access public --tag next | |
if [[ "$PACKAGE_VERSION" != *"-"* ]]; then | |
pnpm dist-tag add @faker-js/faker@$PACKAGE_VERSION latest | |
fi |
Not tested.
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.
No, we are extracting the dist-tag out of the version field and then e.g. alpha, beta or whatever is used
This is default tagging behavior guided to semver
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.
confused: But we don't have alpha or beta tags!? Or did we remove them after stable release?
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.
Oh good that we found out that we misused that before 🫤
- https://www.npmjs.com/package/vite?activeTab=versions
- https://www.npmjs.com/package/typescript?activeTab=versions
- https://www.npmjs.com/package/react?activeTab=versions
just some examples that use e.g. beta dist-tags (which are not my own packages)
env: | ||
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} | ||
|
||
- name: Publish |
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.
According to our release checklist, we should remove the "next branch warning" before the publish.
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'm not sure what this has to do with this PR 🤔
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.
confused: IMO This PR is intended to partially automate the release process, so it should actually contain the same steps as the manual workflow?!
If we don't, we have to permanently remove that section from the readme.
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.
wait, we ever did remove that banner for a release?! I was not aware of that
if I e.g. look in https://www.npmjs.com/package/@faker-js/faker/v/8.4.1 or https://www.npmjs.com/package/@faker-js/faker/v/9.0.0-alpha.0 we did not do that
Only in the newest release and I was not really part of that
IMO we should just remove that banner completely (in a separate PR using docs: *
)
But if you want to you can also leave this open until thursday
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.
FFR: The comment was added for this issue:
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.
After a not so good sleep last night, I decided (at least for my self) that I'm not interested in manipulating repository code from a workflow and so also dont like to work further on that topic especially not from this PR, as the scope and intend was something different from my side.
I just wanted to provide a workflow that can be used to release the "current" state of next branch without having to use credentials manually.
So feel free to either provide a follow-up PR (my preference) or jump into this PR and take it over (not my preference).
This is a GitHub action workflow that let's maintainers of Faker run a npm publish process, so that the package
@faker-js/faker
will be published to npm registry.It is respecting the version and dist-tag by reading the package.json.
The process will be:
// <- this was done locally before
It requires that one of the maintainers create a new access token on NPM for the
@faker-js/faker
package, or for the@faker/*
orga-scope.This then needs to be configured in GitHub as a secret with the name
NPM_AUTH_TOKEN
, so it can be picked up by the CI.Note that
publish
will run theprepublishOnly
script that is configured in thepackage.json
This workflow will NOT "craft" a release, nor will it create tags/releases on github.
It just and only automates the publishing to npm.
Hint: the workflow is tested for 3 months now in https://github.com/salsita/node-pg-migrate