Skip to content

Commit

Permalink
chore: enable monorepo releases
Browse files Browse the repository at this point in the history
  • Loading branch information
steabert committed Mar 18, 2023
1 parent facc9a6 commit 9f8f807
Show file tree
Hide file tree
Showing 24 changed files with 426 additions and 285 deletions.
57 changes: 34 additions & 23 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,72 +6,83 @@ name: Publish

on:
push:
tags:
- v*
branches:
- main

jobs:
publish:
if: ${{ startsWith(github.event.head_commit.message, 'release:') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
lfs: true

- name: Extract version number
id: vars
run: echo ::set-output name=version::v$(jq -r .version package.json)

- name: Setup node
uses: actions/setup-node@v3
with:
node-version: '16'
node-version: '18'
registry-url: 'https://registry.npmjs.org'

- name: Install dependencies
- name: Build
env:
CYPRESS_INSTALL_BINARY: 0
run: yarn install --immutable --immutable-cache

- name: Build
run: yarn build

- name: Release changelog
run: ./scripts/changelog.py --skip-header single > release-CHANGELOG.md
run: |
just install
just build
- name: Release
id: release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # provided by Actions
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body_path: release-CHANGELOG.md
tag_name: ${{ steps.vars.outputs.version }}
release_name: Release ${{ steps.vars.outputs.version }}
body_path: changeset.md
draft: false
prerelease: false

- name: Upload bundle
- name: Upload media-stream-library
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.release.outputs.upload_url }}
asset_path: dist/media-stream-library.min.js
asset_path: streams/dist/media-stream-library.min.js
asset_name: media-stream-library.min.js
asset_content_type: application/javascript

- name: Upload changelog
- name: Upload media-stream-player
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.release.outputs.upload_url }}
asset_path: player/dist/media-stream-player.min.js
asset_name: media-stream-player.min.js
asset_content_type: application/javascript

- name: Upload media-overlay-library
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.release.outputs.upload_url }}
asset_path: CHANGELOG.md
asset_name: CHANGELOG.md
asset_content_type: text/markdown
asset_path: overlay/dist/media-overlay-library.min.js
asset_name: media-overlay-library.min.js
asset_content_type: application/javascript

- name: Deploy NPM package
- name: Deploy NPM packages
env:
YARN_NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
run: |
if [[ $GITHUB_REF =~ alpha|beta ]]; then
yarn npm publish --tag next
yarn workspaces foreach --no-private npm publish --tag next
else
yarn npm publish --tag latest
yarn workspaces foreach --no-private npm publish --tag latest
fi
3 changes: 3 additions & 0 deletions .yarn/cache/cmd-ts-npm-0.12.1-3ec644cf8c-0f7282e121.zip
Git LFS file not shown
3 changes: 3 additions & 0 deletions .yarn/cache/didyoumean-npm-1.2.2-fd568ec571-d5d98719d5.zip
Git LFS file not shown
28 changes: 28 additions & 0 deletions .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs

Large diffs are not rendered by default.

32 changes: 18 additions & 14 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,35 @@
nmHoistingLimits: workspaces

nmMode: hardlinks-local

nodeLinker: node-modules
nmHoistingLimits: workspaces

packageExtensions:
eslint-module-utils@*:
dependencies:
eslint: '*'
eslint-import-resolver-node: '*'
eslint: "*"
eslint-import-resolver-node: "*"
readable-stream@*:
dependencies:
events: '*'
events: "*"
stream-browserify@*:
dependencies:
events: '*'
events: "*"

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: '@yarnpkg/plugin-interactive-tools'
spec: "@yarnpkg/plugin-interactive-tools"
- path: .yarn/plugins/@yarnpkg/plugin-version.cjs
spec: '@yarnpkg/plugin-version'

yarnPath: .yarn/releases/yarn-3.1.1.cjs
spec: "@yarnpkg/plugin-version"
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
spec: "@yarnpkg/plugin-workspace-tools"

supportedArchitectures:
os:
- 'darwin'
- 'linux'
cpu:
- 'x64'
- 'arm64'
- x64
- arm64
os:
- darwin
- linux

yarnPath: .yarn/releases/yarn-3.1.1.cjs
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ All notable changes to this project will be documented in this file.



## [12.0.0](https://github.com/axteams-software/zeno-web/compare/v12.0.0...v12.0.0) (2023-03-18T15:32:02.760Z)

## [v11.1.2-alpha.0](https://github.com/AxisCommunications/media-stream-library-js/compare/v11.1.1...v11.1.2-alpha.0) (2023-01-24 08:17:57 +0100)

### 🐞 Bug fixes
Expand Down
1 change: 1 addition & 0 deletions changeset.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
## [12.0.0](https://github.com/axteams-software/zeno-web/compare/v12.0.0...v12.0.0) (2023-03-18T15:32:02.760Z)
1 change: 1 addition & 0 deletions example-overlay-react/package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"private": true,
"devDependencies": {
"@types/react": "18.0.28",
"@types/react-dom": "18.0.11",
Expand Down
1 change: 1 addition & 0 deletions example-player-react/package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"private": true,
"devDependencies": {
"@vitejs/plugin-react": "3.1.0",
"luxon": "3.3.0",
Expand Down
1 change: 1 addition & 0 deletions example-player-webcomponent/package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"private": true,
"devDependencies": {
"media-stream-player": "workspace:*"
}
Expand Down
1 change: 1 addition & 0 deletions example-streams-node/package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"private": true,
"devDependencies": {
"media-stream-library": "workspace:*",
"yargs": "17.7.1"
Expand Down
1 change: 1 addition & 0 deletions example-streams-web/package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"private": true,
"devDependencies": {
"media-stream-library": "workspace:*"
}
Expand Down
24 changes: 22 additions & 2 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ build: _build-streams _build-player _build-overlay
@changed:
git diff --diff-filter=d --name-only $(git merge-base --fork-point origin/main)

# create a changelog or changeset
changelog:
scripts/changelog.mjs --write=CHANGELOG.md > changeset.md

# format or check files with dprint (default formats all matching files)
dprint +args="fmt":
cd {{ invocation_directory() }} && dprint {{ args }}
Expand Down Expand Up @@ -42,8 +46,11 @@ lint workspace:
cd {{ workspace }} && just dprint check

# create a prerelease commit, KIND=(new|nightly)
release kind='patch':
scripts/release.py {{ kind }}
release $level='patch':
just version $level
just changelog
git add -u
git commit -m "release: $(jq -r .version package.json)"

# start an example RTSP over WebSocket server
rtsp-ws:
Expand All @@ -58,6 +65,15 @@ rtsp-ws:
serve path *args='--bind 0.0.0.0':
http-server {{ path }} {{ args }}

# update the package version of all workspaces
version $level='prerelease':
#!/usr/bin/env bash
current=$(jq -r '.version' package.json)
next=$(semver -i $level --preid alpha $current)
echo "update $workspace: $current => $next"
yarn workspaces foreach version --deferred $next
yarn version apply --all
# run vite development server, WORKSPACE=(player)
vite WORKSPACE *ARGS:
cd {{ WORKSPACE }} && node vite.mjs {{ ARGS }}
Expand All @@ -66,6 +82,10 @@ vite WORKSPACE *ARGS:
run workspace:
just _run-{{ workspace }}

# tag a commit with annotated tag (e.g. just tag v1.2.3 main)
tag tagname commit:
git tag -a -m {{ tagname }} {{ tagname }} {{ commit }}

# run all unit tests
test:
just uvu streams
Expand Down
21 changes: 21 additions & 0 deletions overlay/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License

Copyright (c) 2018-2023 Axis Communications AB

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
5 changes: 2 additions & 3 deletions overlay/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "media-overlay-library",
"version": "4.3.0",
"version": "12.0.0",
"license": "MIT",
"description": "React library for SVG drawing.",
"keywords": [
Expand All @@ -21,9 +21,8 @@
},
"files": [
"dist/**/*",
"README.md",
"LICENSE",
"CHANGELOG.md"
"README.md"
],
"peerDependencies": {
"@juggle/resize-observer": "^3.3.1",
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"name": "media-js",
"version": "12.0.0",
"private": true,
"description": "Media libraries for Node and the Web.",
"workspaces": {
"packages": [
Expand All @@ -17,6 +19,7 @@
"@typescript-eslint/eslint-plugin": "5.55.0",
"@typescript-eslint/parser": "5.55.0",
"c8": "7.13.0",
"cmd-ts": "0.12.1",
"cypress": "12.8.1",
"dpdm": "3.12.0",
"dprint": "0.35.3",
Expand Down
21 changes: 21 additions & 0 deletions player/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License

Copyright (c) 2018-2023 Axis Communications AB

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
9 changes: 4 additions & 5 deletions player/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "media-stream-player",
"version": "8.1.2",
"version": "12.0.0",
"license": "MIT",
"description": "Player built on top of media-stream-library",
"keywords": [
Expand All @@ -25,9 +25,8 @@
},
"files": [
"dist/**/*",
"README.md",
"LICENSE",
"CHANGELOG.md"
"README.md"
],
"dependencies": {
"@juggle/resize-observer": "3.4.0",
Expand All @@ -36,7 +35,7 @@
},
"peerDependencies": {
"luxon": "^3.0.0",
"media-stream-library": "^11.1.1",
"media-stream-library": "^12.0.0",
"react": "^17.0.2 || ^18.1.0",
"react-dom": "^17.0.2 || ^18.1.0",
"styled-components": "^5.3.5"
Expand All @@ -51,7 +50,7 @@
"chalk": "5.2.0",
"esbuild": "0.17.12",
"luxon": "3.3.0",
"media-stream-library": "11.1.1",
"media-stream-library": "12.0.0",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-is": "18.2.0",
Expand Down
Loading

0 comments on commit 9f8f807

Please sign in to comment.