Working on fixing types #9
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
# This workflow will ensure all PRs are labeled so we can later create releases | |
name: Prerelease | |
on: | |
- push | |
- workflow_dispatch | |
jobs: | |
prerelease: | |
if: "github.event_name == 'workflow_dispatch' || contains(github.event.head_commit.message, '[prerelease]')" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: ./.github/actions/setup | |
with: | |
npm_token: ${{secrets.npm_token}} | |
- uses: ./.github/actions/git-creds | |
- name: Check if there are changed packages | |
id: changed-packages | |
run: | | |
changed_packages=$(yarn -s lerna ls --since=origin/master --json --loglevel=error) | |
[[ $changed_packages = "[]" ]] && echo "No packages changed in this branch" && exit 1 || echo "Continuing to prerelease" | |
- name: Build all affected packages | |
run: yarn lerna run build --since=origin/master | |
- name: Generate prerelease prefix | |
run: | | |
normalized_branch_name=$(git rev-parse --abbrev-ref HEAD | tr -dc '[:alnum:]\n\r' | tr '[:upper:]' '[:lower:]') | |
echo "BRANCH=$normalized_branch_name" >> $GITHUB_ENV | |
- name: Generate new versions | |
run: yarn lerna version --exact --conventional-commits --conventional-prerelease --no-changelog --no-push --preid $BRANCH -y | |
- run: yarn config set registry https://registry.npmjs.org/ | |
- name: Setup .npmrc for publish | |
run: npm set "//registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN" | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.npm_token}} | |
- run: npm whoami | |
- name: Publish new versions | |
run: yarn lerna publish from-package --dist-tag $BRANCH -y | |
- name: Get current PR id | |
uses: 8BitJonny/[email protected] | |
id: PR | |
if: success() | |
- name: Create comment with prerelease version details | |
if: success() | |
uses: peter-evans/create-or-update-comment@v1 | |
env: | |
BRANCH: ${{ github.ref_name }} | |
with: | |
issue-number: ${{ steps.PR.outputs.number }} | |
body: | | |
A new prerelease version of this PR has been published! 🎉 | |
To install this prerelease version, run the following command in your terminal with any one of the packages changed in this PR: | |
``` | |
npm i <package_name>@${{ env.BRANCH }} | |
``` | |
Or: | |
``` | |
yarn add <package_name>@${{ env.BRANCH }} | |
``` | |
For example: | |
``` | |
yarn add monday-ui-react-core@${{ env.BRANCH }} | |
``` |