Prerelease Workflow #34
Workflow file for this run
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
name: "Prerelease Workflow" | |
# Manual trigger workflow to automatically setup, build and push a new prerelease on NPM | |
on: | |
workflow_dispatch: | |
inputs: | |
prereleaseName: | |
description: 'Prerelease name' | |
required: true | |
default: 'alpha' | |
type: string | |
concurrency: | |
group: "${{ github.workflow }}-${{ github.ref_name }}" | |
cancel-in-progress: true | |
jobs: | |
publish_version: | |
name: "Publish Prerelease Version" | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Checkout repository" | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: "Setup" | |
uses: ./.github/actions/setup | |
- name: "Increment package versions" | |
id: version | |
uses: ./.github/actions/increment-package-versions | |
with: | |
releaseType: 'prerelease' | |
prereleaseName: '${{ inputs.prereleaseName }}' | |
- name: "Build libs" | |
run: yarn build:libs | |
- name: "Publish version to NPM" | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
DIST_TAG: ${{ steps.version.outputs.distTag }} | |
run: | | |
for package in $(echo packages/lumx-*); | |
do | |
(echo "Publishing $package"; cd $package/dist; npm publish --tag $DIST_TAG) | |
done | |
- name: "Deprecate older prerelease version" | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
PREV_VERSION: ${{ steps.version.outputs.prevDistTagVersion }} | |
if: ${{ env.PREV_VERSION }} | |
run: | | |
packages=$(npm pkg get name -ws | egrep -o '@lumx/\w+' | uniq) | |
for package in $packages; | |
do | |
echo "Deprecate ${package}@${PREV_VERSION}"; | |
npm deprecate ${package}@${PREV_VERSION} deprecated; | |
done |