Publish #106
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Publishes a GitHub release and NPM package for the provided package. | |
# Tags are generated automatically on release. | |
# The release/publish steps can be skipped (in case of a re-release attempt). | |
name: Publish | |
on: | |
workflow_dispatch: | |
inputs: | |
gh-release: | |
description: 'Create a github release?' | |
required: true | |
type: boolean | |
default: true | |
npm-publish: | |
description: 'Publish to NPM?' | |
required: true | |
type: boolean | |
default: true | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: extractions/setup-just@v1 | |
- uses: actions/checkout@v4 | |
- name: Extract version number | |
id: vars | |
run: | | |
echo "version=$(jq -r .version package.json)" >> $GITHUB_OUTPUT | |
- name: Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '22' | |
cache: yarn | |
registry-url: 'https://registry.npmjs.org' | |
- name: Build | |
env: | |
CYPRESS_INSTALL_BINARY: 0 | |
run: | | |
just install | |
just build | |
- name: Create GitHub release | |
if: ${{ inputs.gh-release }} | |
id: release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # provided by Actions | |
run: | | |
yarn pack | |
gh release create v${{ steps.vars.outputs.version }} \ | |
--target ${{ github.ref }} \ | |
-F CHANGELOG.md \ | |
-t "Release v${{ steps.vars.outputs.version }}" \ | |
package.tgz overlay/*.min.js* player/*.min.js* streams/*.min.js* | |
- name: Deploy to NPM registry | |
env: | |
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} | |
run: | | |
if [[ "${{ steps.vars.output.version }}" =~ alpha|beta ]]; then | |
yarn npm publish --tag next | |
else | |
yarn npm publish --tag latest | |
fi |