Skip to content

Commit

Permalink
merge dev
Browse files Browse the repository at this point in the history
  • Loading branch information
jcfranco committed Jun 26, 2024
2 parents 5bb25ad + a0d8eed commit 2c5b6ef
Show file tree
Hide file tree
Showing 209 changed files with 5,568 additions and 2,653 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/accessibility.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ body:
id: packages
attributes:
label: Calcite package
description: Select the relevant [package(s)](https://github.com/Esri/calcite-design-system/tree/main/packages) related to the request.
description: Select the relevant [package(s)](https://github.com/Esri/calcite-design-system/tree/dev/packages) related to the request.
options:
- label: "@esri/calcite-components"
- label: "@esri/calcite-components-angular"
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ body:
id: packages
attributes:
label: Calcite package
description: Select the relevant [package(s)](https://github.com/Esri/calcite-design-system/tree/main/packages) related to the request.
description: Select the relevant [package(s)](https://github.com/Esri/calcite-design-system/tree/dev/packages) related to the request.
options:
- label: "@esri/calcite-components"
- label: "@esri/calcite-components-angular"
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/enhancement.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ body:
id: packages
attributes:
label: Calcite package
description: Select the relevant [package(s)](https://github.com/Esri/calcite-design-system/tree/main/packages) related to the request.
description: Select the relevant [package(s)](https://github.com/Esri/calcite-design-system/tree/dev/packages) related to the request.
options:
- label: "@esri/calcite-components"
- label: "@esri/calcite-components-angular"
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/refactor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ body:
id: packages
attributes:
label: Calcite package
description: Select the relevant [package(s)](https://github.com/Esri/calcite-design-system/tree/main/packages) related to the request.
description: Select the relevant [package(s)](https://github.com/Esri/calcite-design-system/tree/dev/packages) related to the request.
options:
- label: "@esri/calcite-components"
- label: "@esri/calcite-components-angular"
Expand Down
41 changes: 17 additions & 24 deletions .github/scripts/publishPrerelease.sh
Original file line number Diff line number Diff line change
@@ -1,42 +1,37 @@
#!/usr/bin/env bash
set -o errexit

if [ "$BRANCH" = "dev" ]; then
if [ "$NEXT_RELEASE_ENABLED" != "true" ]; then
echo "Next release is disabled"
exit 0
fi

if ! npm run util:is-next-deployable; then
echo "No deployable changes in dev"
exit 0
fi
if [ "$BRANCH" = "dev" ] && [ "$NEXT_RELEASE_ENABLED" != "true" ]; then
echo "Next release is disabled"
exit 0
fi

npm install

if [ "$BRANCH" = "dev" ] && ! npm run util:is-next-deployable; then
echo "No deployable changes on dev"
exit 0
fi

git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"

# version the packages with lerna before building to ensure the version in
# Calcite components' source code preamble is correct for deployment
if [ "$BRANCH" = "dev" ]; then
npm run version:next
elif [ "$BRANCH" = "main" ]; then
npm run version:hotfix
elif [ "$BRANCH" = "rc" ]; then
npm run version:rc
else
echo "Prereleases are only deployable from the 'dev' and 'rc' branches."
exit 1
fi

npm run build
npm test

git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"

# make sure the committed, autogenerated files are up to date before releasing.
# The "|| true" prevents failure if there are no changes.
git add packages/calcite-components/src/components.d.ts package-lock.json || true
git commit -m "build: update types and package-lock" || true

# try deploying storybook, but still release next if it fails with "|| true"
if [ "$BRANCH" = "main" ]; then
if [ "$BRANCH" = "dev" ]; then
{ npm run --workspace=@esri/calcite-components build-storybook &&
npx --workspace=@esri/calcite-components storybook-to-ghpages \
--host-token-env-variable=GH_TOKEN_FOR_STORYBOOK \
Expand All @@ -46,10 +41,8 @@ if [ "$BRANCH" = "main" ]; then
git reset --hard
fi

if [ "$BRANCH" = "main" ]; then
if [ "$BRANCH" = "dev" ]; then
npm run publish:next
elif [ "$BRANCH" = "dev" ]; then
npm run publish:hotfix
elif [ "$BRANCH" = "rc" ]; then
npm run publish:rc
fi
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/chromatic.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: Chromatic
on:
push:
branches: [main, rc, dev]
branches: [rc, dev]
pull_request:
branches: [main, rc, dev]
branches: [rc, dev]
types: [labeled, synchronize]
jobs:
run:
Expand All @@ -20,7 +20,7 @@ jobs:
- run: npm install
- run: npm --workspace="packages/calcite-design-tokens" run build
- name: Publish to Chromatic
uses: chromaui/action@v1
uses: chromaui/action@v11
with:
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
zip: true
Expand Down
61 changes: 55 additions & 6 deletions .github/workflows/deploy-latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,45 @@ permissions:
contents: write
pull-requests: write
jobs:
sync-dev-to-main:
if: github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
ref: main
fetch-depth: 0
token: ${{ secrets.ADMIN_TOKEN }}
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: package.json
- name: Sync dev to main
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
git rebase --autostash origin/dev
git pull --rebase origin main
npm install
npm run build
npm test
git push origin main
release-please:
if: github.event_name != 'workflow_dispatch'
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- uses: google-github-actions/release-please-action@v3.7.13
- uses: google-github-actions/release-please-action@v3.7.6
id: release
with:
command: manifest
token: ${{ secrets.ADMIN_TOKEN }}
default-branch: ${{ github.ref_name }}
default-branch: main
extra-files: |
packages/calcite-components/readme.md
- name: Checkout Repository
Expand All @@ -34,6 +62,11 @@ jobs:
registry-url: "https://registry.npmjs.org"
- name: Build Packages and Publish to NPM
if: ${{ steps.release.outputs.releases_created }}
env:
RELEASED_PATHS: ${{ toJSON(steps.release.outputs.paths_released) }}
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
NPM_CONFIG_PROVENANCE: true
GH_TOKEN: ${{ secrets.ADMIN_TOKEN }}
run: |
npm install
npm run build
Expand All @@ -43,6 +76,8 @@ jobs:
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
release_commit="$(git rev-parse HEAD)"
# The "|| true" prevents failure if there are no changes
git add packages/calcite-components/src/components.d.ts package-lock.json || true
Expand All @@ -61,7 +96,21 @@ jobs:
npm run publish:latest
npm run util:upload-release-assets -- "$RELEASED_PATHS"
env:
RELEASED_PATHS: ${{ toJSON(steps.release.outputs.paths_released) }}
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
NPM_CONFIG_PROVENANCE: true
git checkout -b ci/cherry-pick-release-commit origin/dev
if ! git cherry-pick "$release_commit"; then
git checkout --theirs \
${{github.workspace}}/packages/*/CHANGELOG.md \
${{github.workspace}}/packages/calcite-components-angular/projects/component-library/CHANGELOG.md
git checkout --theirs
${{github.workspace}}/packages/*/package.json \
${{github.workspace}}/packages/calcite-components-angular/projects/component-library/package.json
git cherry-pick --continue
fi
git push -u origin HEAD
gh pr create --fill --head "ci/cherry-pick-release-commit" --base "dev" \
--label "skip visual snapshots"
2 changes: 1 addition & 1 deletion .github/workflows/deploy-prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
# `next` versions are automatically released when deployabled commits are pushed to dev
push:
branches: [dev]
# `hotfix` and `rc` versions must be manually released:
# `rc` versions must be manually released:
# https://docs.github.com/en/actions/using-workflows/manually-running-a-workflow
workflow_dispatch:
jobs:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
run: |
current_branch="$(git rev-parse --abbrev-ref HEAD)"
# diff of branch excluding md
testable_changes=$(git diff --name-only "$current_branch" $(git merge-base "$current_branch" origin/main) -- . ':(exclude)*.md*')
testable_changes=$(git diff --name-only "$current_branch" $(git merge-base "$current_branch" origin/${{ github.base_ref }}) -- . ':(exclude)*.md*')
echo "changed files: $testable_changes"
# skip if there are only md changes
if [ -z "$testable_changes" ]; then
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/schedule-updates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Commit and create pull request
uses: peter-evans/create-pull-request@v6
with:
base: main
base: dev
branch: ci/update-component-docs
delete-branch: true
add-paths: |
Expand Down Expand Up @@ -50,7 +50,7 @@ jobs:
- name: Commit and create pull request
uses: peter-evans/create-pull-request@v6
with:
base: main
base: dev
branch: ci/update-browserslist-db
delete-branch: true
commit-message: "build: update browserslist db"
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ $RECYCLE.BIN/
.env
.idea/
.sass-cache/
.stencil/
.turbo
.versions/
Dockerfile
Expand Down
6 changes: 3 additions & 3 deletions documentation/monorepo.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ Make the following changes and submit a PR:

1. Move devDependencies to the root directory (besides local packages). You will need to regenerate the `package-lock.json` if you copy and paste from `package.json` files.
1. Move GitHub Actions, git hooks, or other CI to the root directory, if applicable. GitHub Actions should follow the the naming convention of `what-it-does_scope.yml`, e.g. `pr-tests_eslint-plugin-calcite-components.yml`
1. Add the path to the package and its current version to [`.release-please-manifest.json`](https://github.com/Esri/calcite-design-system/blob/main/.release-please-manifest.json).
1. In [`release-please-config.json`](https://github.com/Esri/calcite-design-system/blob/main/release-please-config.json) under the `packages` field, add the new package's path as well as any package-specific configurations. The only required field is the package's name, taken from the `name` field in its `package.json`.
1. If the new package needs to be linked to Calcite Component's version, add its name to the `LINKED_VERSIONS_TRACKING_PACKAGES` array in [`support/syncLinkedPackageVersions.ts`](https://github.com/Esri/calcite-design-system/blob/main/support/syncLinkedPackageVersions.ts).
1. Add the path to the package and its current version to [`.release-please-manifest.json`](https://github.com/Esri/calcite-design-system/blob/dev/.release-please-manifest.json).
1. In [`release-please-config.json`](https://github.com/Esri/calcite-design-system/blob/dev/release-please-config.json) under the `packages` field, add the new package's path as well as any package-specific configurations. The only required field is the package's name, taken from the `name` field in its `package.json`.
1. If the new package needs to be linked to Calcite Component's version, add its name to the `LINKED_VERSIONS_TRACKING_PACKAGES` array in [`support/syncLinkedPackageVersions.ts`](https://github.com/Esri/calcite-design-system/blob/dev/support/syncLinkedPackageVersions.ts).
1. Potentially rename the new package's NPM scripts so they match the pipeline names in `turbo.json` (build, test, clean, etc.). Note: having all of the NPM scripts that are specified in `turbo.json` is not required.
1. If present and when possible, the `test` NPM script should *not* build first. Turbo will make sure the `build` script runs first and will cache the results.
1. Potentially rename directories for consistency with the other packages:
Expand Down
31 changes: 13 additions & 18 deletions documentation/releasing.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,16 @@ When releasing during normal work hours, you should block people from merging PR
Follow these steps to release a major, minor, or patch version:

1. Follow the steps above to [prevent merging pull requests](#prevent-merging-pull-requests).
1. [Create a new branch](https://github.com/Esri/calcite-design-system/branches) off of `dev`.
1. Create a pull request from the new branch with `main` as the target.
1. Once the pull request is ready to install, enable "Allow rebase merging" under the Pull Requests section of the [repo settings](https://github.com/Esri/calcite-design-system/settings).
![image](https://github.com/Esri/calcite-design-system/assets/10986395/9fa8be42-7923-47f9-b2d8-df65416e88cc)
1. In the pull request created in step 3, switch the merge method to "Rebase and merge" and install.
![image](https://github.com/Esri/calcite-design-system/assets/10986395/fcbfa86d-950f-459f-8ecd-e468d4373415)
1. Disable the "Allow rebase merging" option from step 4.
1. Sync the changes from `dev` to `main` by dispatching the "Deploy Latest" workflow following [GitHub's documentation](https://docs.github.com/en/actions/using-workflows/manually-running-a-workflow), or using `gh`:

```sh
gh workflow run deploy-latest.yml
```

1. Wait for the [Deploy Latest](https://github.com/Esri/calcite-design-system/actions/workflows/deploy-latest.yml) workflow run on `main` to complete.
1. Review the PR created by `release-please` (titled `chore: release main`) to make sure the changelog(s) and package versioning looks correct.
- There should be a commit on the PR's branch named `docs: remove prerelease changelog entries` that occurred **after** the most recent commit on `main`.
1. Make sure the rest of the PR checks are passing.
1. Approve and install the PR once all checks are passing. You will need to use Admin privilege to override the 6 approval rule.
1. Approve and install the PR. You will need to use Admin privilege to override the 6 approval rule.
1. Wait for the release's [Deploy Latest](https://github.com/Esri/calcite-design-system/actions/workflows/deploy-latest.yml) workflow run to finish.
1. Ensure the released package(s) were deployed to NPM and that [GitHub Releases were created](https://github.com/Esri/calcite-design-system/releases).

Expand All @@ -44,13 +42,7 @@ Follow these steps to release a major, minor, or patch version:
```

1. See the [troubleshooting](#troubleshooting) section if something went wrong, or reach out to Ben or Franco for help.
1. Create a new branch off of `dev` and cherry-pick the release commit from `main` (the version bumps and changelog sections).

```sh
git checkout dev && git pull && git checkout -b cherry-pick-release && git cherry-pick main && git push -u HEAD
```

1. Create a pull request from the new branch to `dev`, and install it by squash merging.
1. A pull request should have been created that cherry-picks the release commit from `main` to `dev`. Review and install the PR using admin privilege.
1. Change the `dev` branch's required approvals back to 1 and save the changes (see the [Prevent merging PRs](#prevent-merging-pull-requests) section)
1. Let the team know via Teams merging is now unblocked in the initial `Core - Releases` message from earlier.

Expand All @@ -59,12 +51,15 @@ Follow these steps to release a major, minor, or patch version:
The following are some troubleshooting steps you can take if a release is unsuccessful.

1. Find the workflow run for the release [here](https://github.com/Esri/calcite-design-system/actions/workflows/deploy-latest.yml), and view the logs to find the error message.
1. Fix the error. In some cases you can resolve the issue with a temporary solution, and then fix the CI after the release is completed. For example, if the `components.d.ts` file is outdated and breaks releases due to an unclean working tree, the [temporary solution](https://github.com/Esri/calcite-design-system/pull/9008) would be to build locally and submit a PR with the updated file. That way you won't be so time crunched when determining an [actual fix](https://github.com/Esri/calcite-design-system/pull/9011) to prevent the same error from occurring in the future. Reach out to Ben or Franco if a solution to the error isn't clear.
1. Fix the error:
- In some cases you can resolve the issue with a temporary solution, and then fix the CI after the release is completed. For example, if the `components.d.ts` file is outdated and breaks releases due to an unclean working tree, the [temporary solution](https://github.com/Esri/calcite-design-system/pull/9008) would be to build locally and submit a PR with the updated file. That way you won't be so time crunched when determining an [actual fix](https://github.com/Esri/calcite-design-system/pull/9011) to prevent the same error from occurring in the future. Reach out to Ben or Franco if a solution to the error isn't clear.
- If the `dev`->`main` sync failed, you may have to resolve merge conflicts locally. See the "Sync dev to main" step in the `deploy-latest.yml` workflow for the process.
- If the release succeeded, but the cherry-pick PR wasn't created, you may need to fix merge conflicts locally.
1. Once the PR with the fix is installed, make sure the new workflow run is passing.
1. **IMPORTANT:** If the new release is showing up in the [GitHub releases](https://github.com/Esri/calcite-design-system/releases) but not on NPM, you'll need to release locally. This signifies the error involved publishing to NPM, which happens after the releases and tags are created on GitHub. To release locally, run the following commands:

```sh
npm install && npm run build && npm test && npm run publish:latest
git fetch && git checkout origin/main && npm install && npm run build && npm test && npm run publish:latest
```

### Bumping the examples
Expand Down
Loading

0 comments on commit 2c5b6ef

Please sign in to comment.