Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: npm autodeploy #350

Merged
merged 11 commits into from
Mar 18, 2024
51 changes: 51 additions & 0 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: NPM Publish

on:
push:
branches:
- main

jobs:
setup_and_build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: "20"
registry-url: "https://registry.npmjs.org/"

- name: Install pnpm
DimaDemchenko marked this conversation as resolved.
Show resolved Hide resolved
run: npm install pnpm -g

- name: Install Dependencies
run: pnpm install

- name: Build
run: pnpm run build

- name: Pack Packages
run: pnpm run pack-packages

publish:
needs: setup_and_build
runs-on: ubuntu-latest
strategy:
matrix:
package:
- p2p-media-loader-core
- p2p-media-loader-hlsjs
- p2p-media-loader-shaka
steps:
- uses: actions/checkout@v4

- name: Get package version
id: get_version
run: |
echo "PACKAGE_VERSION=$(jq -r '.version' ./packages/${{ matrix.package }}/package.json)" >> $GITHUB_ENV

- name: Publish Package
run: pnpm publish ./packages/${{ matrix.package }}-${{ env.PACKAGE_VERSION }}.tgz
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}