Skip to content

Commit

Permalink
chore: npm publish for release workflow (#1377)
Browse files Browse the repository at this point in the history
* chore: add npm publish step for release workflow

* chore: update documentation for release flow

* use next-2

* chore: rename workflow name from github-release to release and add discussion category name for github releases

---------

Co-authored-by: Dzianis Dashkevich <[email protected]>
  • Loading branch information
dzianis-dashkevich and Dzianis Dashkevich authored Mar 1, 2023
1 parent 83fb204 commit 27d1108
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: github-release
name: release
on:
push:
tags:
Expand All @@ -7,7 +7,7 @@ on:
# match semver pre-releases
- "v[0-9]+.[0-9]+.[0-9]+-*"
jobs:
github-release:
release:
env:
NETLIFY_BASE: 'videojs-http-streaming.netlify.app'
runs-on: ubuntu-latest
Expand All @@ -29,12 +29,17 @@ jobs:
with:
node-version: '${{steps.nvm.outputs.NVMRC}}'
cache: npm
# this line is required for the setup-node action to be able to run the npm publish below.
registry-url: 'https://registry.npmjs.org'

- name: npm install
run: npm i --prefer-offline --no-audit

- name: build
run: npm run build-prod --if-present
# publish runs build for us via a prepublishOnly script
- name: npm release
run: npm publish --tag next-2
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Check if this is a pre-release
run: echo ::set-output name=IS_PRE_RELEASE::$(npx -p not-prerelease is-prerelease && echo "true" || echo "false")
Expand Down Expand Up @@ -67,3 +72,5 @@ jobs:
files: |
dist/**/*.js
dist/**/*.css
discussion_category_name: Releases

11 changes: 5 additions & 6 deletions COLLABORATOR_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Install dependencies for the project.
npm install
```

Then, it's mostly a standard npm package release process with running `npm version`, followed by an `npm publish`.
Update version.

```sh
npm version {major|minor|patch}
Expand All @@ -71,17 +71,16 @@ See [deciding what type of version release section](#deciding-what-type-of-versi
Optionally, you can run `git show` now to verify that the version update and CHANGELOG automation worked as expected.

Afterwards, you want to push the commit and the tag to the repo.
It's necessary to do this before running `npm publish` because our GitHub release automation relies on the commit being available on GitHub.

```sh
git push --follow-tags origin main
```

Publish to npm.
After the tag was pushed, GitHub actions will trigger the `release` workflow, which will do the following:

```sh
npm publish
```
* Publish to npm with `next` or `next-{n}` depending on your current major version.
* Create GitHub release with changelog and Netlify preview.
* Create a GitHub `releases` discussion linked to the GitHub release.

If it's a large enough release, consider writing a blog post as well.

Expand Down

0 comments on commit 27d1108

Please sign in to comment.