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
Copy file name to clipboardExpand all lines: README.md
+62Lines changed: 62 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -161,3 +161,65 @@ If you're going to run `xs test` on GitHub Actions, please keep in mind that it
161
161
- name: Test
162
162
run: xvfb-run --auto-servernum npm test
163
163
```
164
+
165
+
### Publishing on GitHub Actions
166
+
167
+
Publishing on GitHub Actions requires a little customization. Typically, running `xs release` locally will also publish, however, if you want to defer publishing on GitHub Actions, you can modify the default `xs release` in your **package.json** like this:
168
+
169
+
```json
170
+
{
171
+
"scripts": {
172
+
"build": "xs build",
173
+
"release": "xs bump,test,deploy,git-push",
174
+
"publish-ci": "xs publish",
175
+
}
176
+
}
177
+
```
178
+
179
+
Here's a snippet of the a GitHub Actions workflow to trigger a publish when a release is published. For more information on creating publishing workflow check out this [documentation](https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages).
180
+
181
+
```yml
182
+
name: Publish Package
183
+
on:
184
+
release:
185
+
types: [published]
186
+
jobs:
187
+
publish:
188
+
- uses: actions/checkout@v4
189
+
- uses: actions/setup-node@v4
190
+
with:
191
+
node-version: '20.x'
192
+
registry-url: 'https://registry.npmjs.org'
193
+
- run: npm ci
194
+
- run: npm run build
195
+
- run: npm run publish-ci
196
+
env:
197
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
198
+
```
199
+
200
+
Finally, if you need to publishing to a different [dist-tag](https://docs.npmjs.com/cli/v10/commands/npm-dist-tag) when publishing, you can use the `XS_PUBLISH_TAG` environment variable. In this example, prereleases will be published to a `beta` dist-tag.
0 commit comments