-
Notifications
You must be signed in to change notification settings - Fork 321
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
677 changed files
with
11,177 additions
and
6,362 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: Check Changed Packages | ||
description: Check if there are any changed packages in the monorepo | ||
|
||
inputs: | ||
exit_on_no_changes: | ||
description: Whether to exit with a non-zero code if there are no changes. | ||
required: false | ||
default: "false" | ||
outputs: | ||
has_changes: | ||
description: Whether there are any changes in the monorepo. | ||
value: ${{ steps.check-changed-packages.outputs.has_changes }} | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- id: determine-since-flag | ||
uses: ./.github/actions/determine-lerna-since-flag | ||
- id: check-changed-packages | ||
shell: bash | ||
env: | ||
SINCE_FLAG: ${{ steps.determine-since-flag.outputs.since_flag }} | ||
run: | | ||
changed_packages=$(yarn -s lerna ls $SINCE_FLAG --json --loglevel=error) | ||
if [[ $changed_packages = "[]" ]]; then | ||
echo "has_changes=false" >> $GITHUB_OUTPUT | ||
echo "No packages to process as Lerna didn't detect any changes." | ||
if [[ "${{ inputs.exit_on_no_changes }}" == "true" ]]; then | ||
exit 1 | ||
else | ||
echo "Continuing because exit_on_no_changes is not used." | ||
fi | ||
else | ||
echo "has_changes=true" >> $GITHUB_OUTPUT | ||
echo "Change detected:" | ||
echo "$changed_packages" | ||
fi |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: Determine Lerna since flag | ||
description: Determine the --since flag value for Lerna commands based on the branch. Should be used for workflows/actions that can be used on both default branch and other branches. | ||
|
||
outputs: | ||
since_flag: | ||
description: The --since flag value to use with Lerna commands. | ||
value: ${{ steps.get-since-flag.outputs.since_flag }} | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- id: get-since-flag | ||
shell: bash | ||
run: | | ||
if [[ "$GITHUB_REF" == "refs/heads/master" ]]; then | ||
since_flag="--since" | ||
echo "Running on master branch, checking for all changes." | ||
else | ||
since_flag="--since=origin/master...HEAD" | ||
echo "Not running on master branch, checking for changes since origin/master." | ||
fi | ||
echo "since_flag=$since_flag" >> $GITHUB_OUTPUT |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
name: Download and Extract Build Artifacts | ||
description: Download build artifacts for all the packages and extract them to the correct location | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Download and Extract | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: ci-builds-${{ github.run_id }}-${{ github.run_attempt }} | ||
path: packages/ |
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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: Build and Upload Artifacts | ||
|
||
on: | ||
workflow_call: | ||
secrets: | ||
npm_token: | ||
required: true | ||
outputs: | ||
has_changes: | ||
description: Whether there are any changes in the monorepo. | ||
value: ${{ jobs.build-and-upload.outputs.has_changes }} | ||
|
||
jobs: | ||
build-and-upload: | ||
name: Build and Upload | ||
runs-on: ubuntu-latest | ||
outputs: | ||
has_changes: ${{ steps.check-changed-packages.outputs.has_changes }} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Run Setup | ||
uses: ./.github/actions/setup | ||
with: | ||
npm_token: ${{ secrets.npm_token }} | ||
- id: check-changed-packages | ||
uses: ./.github/actions/check-changed-packages | ||
- id: determine-since-flag | ||
if: ${{ steps.check-changed-packages.outputs.has_changes == 'true' }} | ||
uses: ./.github/actions/determine-lerna-since-flag | ||
- name: Build | ||
if: ${{ steps.check-changed-packages.outputs.has_changes == 'true' }} | ||
shell: bash | ||
env: | ||
SINCE_FLAG: ${{ steps.determine-since-flag.outputs.since_flag }} | ||
run: yarn lerna run build $SINCE_FLAG --include-dependencies | ||
- name: Upload | ||
if: ${{ steps.check-changed-packages.outputs.has_changes == 'true' }} | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ci-builds-${{ github.run_id }}-${{ github.run_attempt }} | ||
path: "./packages/*/dist/" | ||
if-no-files-found: ignore |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,31 @@ | ||
name: "Chromatic" | ||
name: Chromatic | ||
|
||
on: push | ||
|
||
jobs: | ||
chromatic-deployment: | ||
build: | ||
name: Build | ||
uses: ./.github/workflows/build-and-upload.yml | ||
secrets: | ||
npm_token: ${{ secrets.npm_token }} | ||
|
||
publish-chromatic: | ||
name: Publish Chromatic | ||
needs: build | ||
if: ${{ needs.build.outputs.has_changes == 'true' }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Install dependencies | ||
run: yarn | ||
- name: Run Build | ||
shell: bash | ||
run: yarn lerna run build --since=origin/master | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Run Setup | ||
uses: ./.github/actions/setup | ||
with: | ||
npm_token: ${{ secrets.npm_token }} | ||
- uses: ./.github/actions/download-builds | ||
- name: Publish to Chromatic | ||
uses: chromaui/action@v1 | ||
uses: chromaui/action@v11 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
# 👇 Chromatic projectToken, if you are project maintainer refer to the manage page to obtain it. | ||
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }} | ||
workingDir: packages/core |
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
name: PR Checks | ||
|
||
on: | ||
pull_request: | ||
types: [opened, synchronize] | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
uses: ./.github/workflows/build-and-upload.yml | ||
secrets: | ||
npm_token: ${{ secrets.npm_token }} | ||
|
||
test: | ||
name: Test | ||
needs: build | ||
if: ${{ needs.build.outputs.has_changes == 'true' }} | ||
uses: ./.github/workflows/test.yml | ||
secrets: | ||
npm_token: ${{ secrets.npm_token }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,80 +1,72 @@ | ||
# This workflow will ensure all PRs are labeled so we can later create releases | ||
|
||
name: Prerelease | ||
|
||
on: | ||
- push | ||
- workflow_dispatch | ||
push: | ||
branches-ignore: | ||
- "master" | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
if: "contains(github.event.head_commit.message, '[prerelease]')" | ||
uses: ./.github/workflows/build-and-upload.yml | ||
secrets: | ||
npm_token: ${{ secrets.npm_token }} | ||
|
||
prerelease: | ||
if: "github.event_name == 'workflow_dispatch' || contains(github.event.head_commit.message, '[prerelease]')" | ||
name: Prerelease | ||
needs: build | ||
if: ${{ needs.build.outputs.has_changes == 'true' }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
ref: ${{ github.head_ref }} | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version-file: ".nvmrc" | ||
registry-url: https://registry.npmjs.org/ | ||
- name: Install dependencies | ||
run: npm ci | ||
- name: Set up git credentials | ||
run: | | ||
git config --global user.name 'ci' | ||
git config --global user.email '[email protected]' | ||
- name: "Wait for tests to succeed" | ||
uses: fountainhead/[email protected] | ||
if: success() | ||
id: wait-for-tests | ||
- name: Run Setup | ||
uses: ./.github/actions/setup | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
checkName: "test" | ||
ref: ${{ github.event.pull_request.head.sha || github.sha }} | ||
timeoutSeconds: 1200 | ||
intervalSeconds: 20 | ||
- name: "Tests failed - exit" | ||
if: steps.wait-for-tests.outputs.conclusion != 'success' | ||
npm_token: ${{ secrets.npm_token }} | ||
- uses: ./.github/actions/git-creds | ||
- uses: ./.github/actions/download-builds | ||
- name: Generate new versions | ||
id: generate-versions | ||
run: | | ||
echo "::error::test check failed - prerelease cancelled" | ||
exit 1 | ||
- name: Create Updated version | ||
id: create-update-version | ||
if: success() | ||
env: | ||
BRANCH_NAME: ${{ github.head_ref || github.ref_name }} | ||
COMMIT_SHA: ${{ github.event.pull_request.head.sha || github.sha }} | ||
run: | | ||
npm run pre-release | ||
echo "package_version=$(node -e "console.log(require('./package.json').version)")" >> $GITHUB_OUTPUT | ||
- name: Publish the new version to npm | ||
if: success() | ||
run: npm run build && npm publish --tag prerelease | ||
preid=${{ github.ref_name }} | ||
normalized_pre_id=$(echo "$preid" | tr -dc '[:alnum:]\n\r' | tr '[:upper:]' '[:lower:]') | ||
full_output=$(yarn lerna version --exact --conventional-commits --conventional-prerelease --json --no-changelog --no-push --preid "$normalized_pre_id" -y) | ||
# extract only the JSON portion from the full output, excluding yarn logs | ||
json_output=$(echo "$full_output" | awk '/^\[/{p=1} p; /\]/{p=0}' ) | ||
echo 'new_versions<<EOF' >> $GITHUB_OUTPUT | ||
echo "$json_output" >> $GITHUB_OUTPUT | ||
echo 'EOF' >> $GITHUB_OUTPUT | ||
- 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 }} | ||
- uses: "marvinpinto/action-automatic-releases@latest" | ||
if: success() | ||
with: | ||
repo_token: "${{ secrets.GITHUB_TOKEN }}" | ||
prerelease: true | ||
automatic_release_tag: prerelease | ||
- name: Publish new versions | ||
run: yarn lerna publish from-package --dist-tag prerelease -y | ||
- name: Get current PR id | ||
uses: 8BitJonny/gh-get-current-pr@2.2.0 | ||
uses: 8BitJonny/gh-get-current-pr@3.0.0 | ||
id: PR | ||
if: success() | ||
- name: Prepare PR comment | ||
id: prepare-comment | ||
env: | ||
json_data: ${{ steps.generate-versions.outputs.new_versions }} | ||
run: | | ||
echo 'comment_body<<EOF' >> $GITHUB_OUTPUT | ||
echo "A new prerelease version of this PR has been published! 🎉" >> $GITHUB_OUTPUT | ||
echo "To install this prerelease version, run the following command in your terminal with any one of the packages changed in this PR:" >> $GITHUB_OUTPUT | ||
echo "$json_data" | jq -r '.[] | "\nTo update `\(.name)`:\n```\nyarn add \(.name)@\(.newVersion)\n```\nOr with npm:\n```\nnpm i \(.name)@\(.newVersion)\n```\n"' >> $GITHUB_OUTPUT | ||
echo 'EOF' >> $GITHUB_OUTPUT | ||
- name: Create comment with prerelease version details | ||
if: success() | ||
uses: peter-evans/create-or-update-comment@v1 | ||
uses: peter-evans/create-or-update-comment@v4 | ||
with: | ||
issue-number: ${{ steps.PR.outputs.number }} | ||
body: | | ||
A new prerelease version of this PR has been published: `${{ steps.create-update-version.outputs.package_version }}` | ||
``` | ||
// To install this prerelease version using npm, please run the following command in your terminal: | ||
npm i monday-ui-react-core@${{ steps.create-update-version.outputs.package_version }} | ||
// If you prefer using Yarn, you can use the following command instead: | ||
yarn add monday-ui-react-core@${{ steps.create-update-version.outputs.package_version }} | ||
``` | ||
body: ${{ steps.prepare-comment.outputs.comment_body }} |
Oops, something went wrong.