You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- The `changeset` command will version your packages before the test release. To version them as a beta add `--snapshot beta` to the changeset command
84
+
- I am including the `dry-run` flag here so if you copy paste it, you will "dry-run" the publish.
85
+
- I also like to add the `registry` flag, as a secondary check to make sure I publish to this registry.
86
+
- The `-r` flag is necessary if your package requires other workspace packages to be published. This command runs `publish` recursively via pnpm's topological graph. To publish all packages, include the `-r` flag and remove `packages/{yourpackage}` from the publish command.
87
+
- Include the `--no-git-checks` flag to ignore the changes made by the versioning command
88
+
- To test publish a beta, add `--tag beta`
89
+
- If you are publishing from a branch other than `main`, add `--publish-branch {branch-name}`
90
+
91
+
2. Publishing to a hosted private registry: Please message `@ryan.basmajian` on Slack.
92
+
58
93
## First time releasing a package
59
94
60
-
If your package is ready to be released, and has never been released before,
61
-
(the package.json `name` field does not exist on `npm`), then it is critical that
62
-
your `{packageRoot}/package.json` has the following:
95
+
If your package is ready to be released, and has never been released before, (the package.json `name` field does not exist on `npm`), then it is critical that the package be published manually as a beta first.
63
96
64
-
```
97
+
First ensure that the `{packageRoot}/package.json` has the following:
98
+
99
+
```json
65
100
"publishConfig": {
66
101
"access": "public"
67
102
}
68
103
```
69
104
70
-
If your package does not contain this information, your package publishing **WILL**
71
-
break the publish pipeline.
105
+
When the package is officially ready for release, you should also delete the `private: true` from the `{projectRoot}/package.json`.
72
106
73
-
This is because all packages in this repository are published with `npm provenance`.
74
-
You can read about the requirements [here](https://docs.npmjs.com/generating-provenance-statements#prerequisites).
107
+
Then publish the package to npm:
75
108
76
-
## Testing a package publish
109
+
```bash
110
+
# Version packages for beta
111
+
pnpm changeset version --snapshot beta
112
+
# Check that the beta tag is correct in a dry run
113
+
pnpm publish <package-name> --tag beta --no-git-checks --access public --dry-run
114
+
# Publish beta for the first time
115
+
pnpm publish <package-name> --tag beta --no-git-checks --access public
116
+
```
77
117
78
-
In order to test a package publish, you should use `verdaccio`.
118
+
If you do not do this, your package publishing **WILL** break the publish pipeline. Publishing manually first prevents the package being published as the default private.
79
119
80
-
We provide verdaccio two ways:
120
+
Next set up provenance and trusted publishing. With trusted publishing enabled, provenance attestations will be generated automatically. Learn more [here](https://docs.npmjs.com/trusted-publishers#automatic-provenance-generation).
121
+
122
+
To set up trusted publishing, follow the instructions [here](https://docs.npmjs.com/trusted-publishers#for-github-actions). Configure the following fields:
81
123
82
-
-`pnpm nx run local-registry`. This command will spawn a private npm registry.
83
-
It also _should_ update your local `.npmrc` file to point here.
124
+
-**Publisher**: GitHub Actions
125
+
-**Organization**: ForgeRock
126
+
-**Repository**: ping-javascript-sdk
127
+
-**Workflow filename**: publish.yml
84
128
85
-
You can then publish your package like so:
129
+
Additionally, set the publishing access to `Require two-factor authentication and disallow tokens`.
You should now be able to publish with provenance from GitHub Actions. To learn how to publish a beta from GitHub Actions see the next section [Publishing a beta](#publishing-a-beta) below.
90
132
91
-
Notes: - I am including the `dry-run` flag here so if you copy paste it,
92
-
you will "dry-run" the publish. - I also like to add the `registry` flag, as a secondary check to
93
-
make sure i publish to this registry. - The `-r` flag is necessary if your package requires other workspace packages
94
-
to be published. This command runs `publish` recursively via pnpm's
95
-
topological graph.
133
+
## Publishing a beta
96
134
97
-
- Publishing to a hosted private registry: Please message @ryanbas21on slack.
135
+
You can trigger a beta publish manually via the `publish.yml` GitHub action. In GitHub, select the `Actions` tab then the `Publish` workflow. Then select the `Run workflow` dropdown on the right-hand side. Select the branch you want to release in the `Use workflow from` dropdown, then fill out the beta release options. Click `Run workflow` and the action will automatically release the changeset snapshot to npm.
0 commit comments