This is a GitHub Action parse Lerna tags. It provides publishes and deploys packages independently.
Provide next output values:
scope
package_name
version
Set next env variables:
LERNA_PACKAGE_SCOPE
LERNA_PACKAGE_NAME
LERNA_PACKAGE_VERSION
With Scope Tag @mycompany/[email protected]
Output values
steps.<step.id>.outputs.scope
=>@mycompany
steps.<step.id>.outputs.package_name
=>my-package
steps.<step.id>.outputs.version
=>0.0.1
Set env
env.LERNA_PACKAGE_SCOPE
=>@mycompany
env.LERNA_PACKAGE_NAME
=>my-package
env.LERNA_PACKAGE_VERSION
=>0.0.1
Without Scope Tag [email protected]
Output values
steps.<step.id>.outputs.scope
=>''
steps.<step.id>.outputs.package_name
=>my-package
steps.<step.id>.outputs.version
=>0.0.1
Set env
env.LERNA_PACKAGE_SCOPE
=>''
env.LERNA_PACKAGE_NAME
=>my-package
env.LERNA_PACKAGE_VERSION
=>0.0.1
name: Deploy Lerna Packages
on:
push:
tags:
- '**@[0-9]+.[0-9]+.[0-9]+'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: igor-lemon/[email protected]
id: lerna-package
- name: Build and deploy the Core SDK
if: ${{ steps.lerna-package.outputs.package_name == 'core-sdk' }}
run: |
echo "[CORE SDK] Start Deploy ${{ env.LERNA_PACKAGE_NAME }} v${{ env.LERNA_PACKAGE_VERSION }}, with ${{ env.LERNA_PACKAGE_SCOPE }} scope"
- name: Build and deploy the Public SDK
if: ${{ steps.lerna-package.outputs.package_name == 'public-sdk' }}
run: |
echo "[PUBLIC SDK] Start Deploy ${{ env.LERNA_PACKAGE_NAME }} v${{ env.LERNA_PACKAGE_VERSION }}, with ${{ env.LERNA_PACKAGE_SCOPE }} scope"